﻿#include "MGData.h"
#include "stdafx.h"
#include "math.h"
#include "FileDlg.h"
#include <locale.h>
#include "JsonAnalysis.h"
#include "FileVerison_Info.h"
#include "GuiFan.h"
CMGData::CMGData()
{

}


CMGData::~CMGData()
{
}

//随机数  范围：(nMin - nMax)/2 — (nMIn + nMax) / 2
int CMGData::GetRandVal(int nMin, int nMax)
{	
	int nRes = rand() % (nMax - nMin + 1) + nMin;
	return nRes - (nMin + nMax) / 2;
}

//新建数据
void CMGData::CreateNewData(NEW_DATA New_Data)
{
//	DATA_TYPE DataType = GetDataType(New_Data.nGuiFan);
	srand(time(0));

	MG_PROJECT_INFO Pro_Info;
	ZeroMemory(&Pro_Info, sizeof(Pro_Info));

	Pro_Info.chStandard = New_Data.nGuiFan;
	Pro_Info.chGuiFanType = New_Data.nGuiFanType;
	Pro_Info.chGuiFanName = New_Data.nGuiFanName;
	Pro_Info.nMaxLoad = New_Data.nMaxLoad;
	Pro_Info.nChuShiHeZai = New_Data.nFirstLoadGrade;
	Pro_Info.chXunHuanCnt = New_Data.nXunHuan;
	Pro_Info.chSafetyLevel = New_Data.nSafeLevel;
	Pro_Info.chMaoGanType = New_Data.nMGType;
	Pro_Info.chMaoGanFangShi = New_Data.nMGFangshi;
	Pro_Info.chGuDingType = New_Data.nGDType;
	
	USES_CONVERSION;
	CString strVal(L"");
	CTime ct;
	ct = CTime::GetCurrentTime();
	strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
	strcpy_s(Pro_Info.chTestDate, sizeof(Pro_Info.chTestDate), W2A(strVal));
	strcpy_s(Pro_Info.chWeiTuoDate, sizeof(Pro_Info.chWeiTuoDate), W2A(strVal));
	strcpy_s(Pro_Info.chShiGongDate, sizeof(Pro_Info.chShiGongDate), W2A(strVal));
	strcpy_s(Pro_Info.chUploadDate, sizeof(Pro_Info.chUploadDate), W2A(strVal));

	strVal = L"虚拟工程";
	strcpy_s(Pro_Info.chProjectName, sizeof(Pro_Info.chProjectName), W2A(strVal));
	Pro_Info.fPileDiam = 100;
	Pro_Info.fPilelength = 10.00;
	memcpy(Pro_Info.chTestNo, "T0001", sizeof(Pro_Info.chTestNo));
	memcpy(Pro_Info.chPileNum, "MG001", sizeof(Pro_Info.chPileNum));
	Pro_Info.chShowTime = 1;
	for (int i = 0; i < nWeiYiCnt; i++)
	{
		if (New_Data.bChannelSel[i])
		{
			Pro_Info.chChanelUsed[i] = 1;
			Pro_Info.chChannelSel[i] = 1;
		}
		else
		{
			Pro_Info.chChanelUsed[i] = 0;
			Pro_Info.chChannelSel[i] = 0;
		}

	}
	for (int i = 0; i < 12; ++i)
	{
		Pro_Info.nLoadTimeList[i] = New_Data.nLoadTimeGap[i];
		Pro_Info.nLoadOffTimeList[i] = New_Data.nLoadoffTimeGap[i];
	}

	vector<DATA_INFO> vDataInfo;
	if (New_Data.nGuiFan == GF_JGJ_120_2012_JB)		//JGJ 120-2012 基本试验
	{
		CreateNewData1(Pro_Info, vDataInfo);
	}
	else if (New_Data.nGuiFan == GF_JGJ_120_2012_YS)	//JGJ 120-2012 验收试验
	{
		CreateNewData2(Pro_Info, vDataInfo);
	}
	else if (New_Data.nGuiFan == GF_GB_50330_2013_JB	//GB 50330-2013 基本试验
		)	
	{
		CreateNewData3(Pro_Info, vDataInfo);
	}
	else if (New_Data.nGuiFan == GF_GB_50330_2013_YS)	//GB 50330-2013 验收试验
	{
		CreateNewData4(Pro_Info, vDataInfo);
	}
	else if (New_Data.nGuiFan == GF_JGJ_T_401_2017_JB_S		//  JGJ/T 401-2017 锚杆单循环基本试验
		|| New_Data.nGuiFan == GF_DB32_T_3916_2020_JB_S	//  DB32/T 3916-2020 锚杆单循环基本试验
		)
	{
		CreateNewData5(Pro_Info, vDataInfo);
	}
	else if (New_Data.nGuiFan == GF_JGJ_T_401_2017_YS_S) // JGJ/T 401-2017 锚杆单循环验收试验
	{
		CreateNewData_GF_JGJ_T_401_2017_YS_S(Pro_Info, vDataInfo);
	}
	else if (New_Data.nGuiFan == GF_JGJ_T_401_2017_JB_D // JGJ/T 401-2017 锚杆多循环基本试验
		|| New_Data.nGuiFan == GF_DB32_T_3916_2020_JB_D // DB32/T 3916-2020 锚杆多循环基本试验
		)
	{
		CreateNewData6(Pro_Info, vDataInfo);
	}
	else if (New_Data.nGuiFan == GF_JGJ_T_401_2017_JB_F	// JGJ/T 401-2017 锚杆分级维持荷载基本试验
		|| New_Data.nGuiFan == GF_DB32_T_3916_2020_JB_F	// DB32/T 3916-2020 锚杆分级维持荷载基本试验
		|| New_Data.nGuiFan == GF_JGJ_T_401_2017_YS_F	//  JGJ/T 401-2017 锚杆分级维持荷载验收试验
		|| New_Data.nGuiFan == GF_DB32_T_3916_2020_YS_F	//  DB32/T 3916-2020 锚杆分级维持荷载验收试验
		)
	{
		CreateNewData7(Pro_Info, vDataInfo);
	}
	else if (New_Data.nGuiFan == GF_JGJ_T_401_2017_YS_D	//  JGJ/T 401-2017 锚杆多循环验收试验
		|| New_Data.nGuiFan == GF_DB32_T_3916_2020_YS_D	// DB32/T 3916-2020 锚杆多循环验收试验
		)
	{
		CreateNewData8(Pro_Info, vDataInfo);
	}
	else if (New_Data.nGuiFan == GF_CECS22_2005_JB)//  CECS:22 2005 锚杆基本试验
	{
		CreateNewData_CECS_22_2005_JB(Pro_Info, vDataInfo);
	}
	else if (New_Data.nGuiFan == GF_CECS22_2005_YS)//  CECS:22 2005 锚杆验收试验
	{
		CreateNewData_CECS_22_2005_YS(Pro_Info, vDataInfo);
	}
	else if (New_Data.nGuiFan == GF_GB50086_2015_JB)//  GB50086-2015 锚杆基本试验
	{
		CreateNewData_GB50086_2015_JB(Pro_Info, vDataInfo);
	}
	else if (New_Data.nGuiFan == GF_GB50086_2015_YS_S)//  GB50086-2015 锚杆单循环验收试验
	{
		CreateNewData_GB50086_2015_YS_S(Pro_Info, vDataInfo);
	}
	else if (New_Data.nGuiFan == GF_GB50086_2015_YS_D)	//GB50086-2015 锚杆多循环验收试验
	{
		CreateNewData_GB50086_2015_YS_D(Pro_Info, vDataInfo);
	}
	else if (New_Data.nGuiFan == GF_TB_10025_2019_YS_S)	//TB 10025-2019 锚杆单循环验收试验
	{		
		CreateNewData_TB_10025_2019_YS_S(Pro_Info, vDataInfo);
	}
	else if (New_Data.nGuiFan == GF_TB_10025_2019_YS_D)	//TB 10025-2019 锚杆多循环验收试验
	{
		CreateNewData_TB_10025_2019_YS_D(Pro_Info, vDataInfo);
	}
	else if (New_Data.nGuiFan == GF_TB_10025_2019_JB)		//TB 10025-2019 基本试验)
	{
		CreateNewData_TB_10025_2019_JB(Pro_Info, vDataInfo);
	}
	else if (New_Data.nGuiFan == GF_GB_50007_2011_JB)
	{
		CreateNewData_GF_GB_50007_2011_JB(Pro_Info, vDataInfo);
	}
	else if (New_Data.nGuiFan == GF_GB_50007_2011_YS)
	{
		CreateNewData_GF_GB_50007_2011_YS(Pro_Info, vDataInfo);
	}
	else
	{
		//锚杆一期
		CreateNewData0(Pro_Info, vDataInfo);
	}

	m_MGProInfo = Pro_Info;
	m_MGProInfo_Old = Pro_Info;
	m_vDataInfo_Old = vDataInfo;
	m_vDataInfo = vDataInfo;

	SetCurveUnit(m_MGProInfo);
	InitCalcData();
}

//GB 50007-2011 锚杆验收试验
void CMGData::CreateNewData_GF_GB_50007_2011_YS(MG_PROJECT_INFO &Pro_Info, vector<DATA_INFO> &vDataInfo)
{
	DATA_INFO Dt_Info;
	ZeroMemory(&Dt_Info, sizeof(DATA_INFO));
	Dt_Info.chBeiZhu[0] = '\0';
	USES_CONVERSION;
	CString strVal(L"");
	float fVal = 0;
	float fLastVal = 0; //上一级位移

	CTime ct;
	ct = CTime::GetCurrentTime();

	int nBenjiId = 0;
	float fWeiyi = 0;
	float nBegnLoad = 0, nEndLoad = 0;

	float fGapWeiyi = 0.02f;
	float fMaxLoadVal = Pro_Info.nMaxLoad;
	int nXunHuanCnt = 7; //10 30 50 70 80 90 100 
	vector<int> vLoad;
	vLoad.push_back(Pro_Info.nChuShiHeZai);
	vLoad.push_back(30);
	vLoad.push_back(50);
	vLoad.push_back(70);
	vLoad.push_back(80);
	vLoad.push_back(90);
	vLoad.push_back(100);
	//最大荷载按照0.8确定
	fMaxLoadVal *= 0.8;
	//初始拉力
	float nInitLoad = int(fMaxLoadVal* Pro_Info.nChuShiHeZai / 100);
	float nGapLoad = fMaxLoadVal / 10; //间隔拉力
	//根据循环加数据
	for (int i = 0; i < 2; ++i)
	{
		if (0 == i)
		{
			Dt_Info.nRecordId = 0;
			Dt_Info.nIdx = 0;

			Dt_Info.fCurLoad = 0;
			Dt_Info.fLoadValue = 0;
			Dt_Info.nJiaZaiOrXieZai = LOAD_VALUE;
			Dt_Info.nTimeGap = Pro_Info.nLoadTimeList[0];

			strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
			strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));

			Dt_Info.fWeiyiAvg = 0;
			for (int m = 0; m < nWeiYiCnt; ++m)
			{
				Dt_Info.fWeiyi[m] = fWeiyi;
			}
			Dt_Info.fCurYouya = 0;

			vDataInfo.push_back(Dt_Info);
			continue;
		}
		nBenjiId = 1;
		//加载数据
		float nLoad = nInitLoad;
		for (int nL = 0; nL < nXunHuanCnt; nL++)
		{
// 			if (nL == 0)
// 			{
// 				nLoad = nInitLoad + GetRandVal(RAND_MIN_VAL, RAND_MAX_VAL);
// 			}
// 			else if (nL < 3)
// 			{
// 				nLoad += (nGapLoad * 2) + GetRandVal(RAND_MIN_VAL, RAND_MAX_VAL);
// 			}
// 			else
// 			{
// 				nLoad += (nGapLoad)+GetRandVal(RAND_MIN_VAL, RAND_MAX_VAL);
// 			}
			nLoad = vLoad[nL] * fMaxLoadVal / 100.0;

			Dt_Info.nIdx = nBenjiId;
			Dt_Info.fLoadValue = (float)nLoad;
			Dt_Info.fCurLoad = Dt_Info.fLoadValue + GetRandVal(RAND_MIN_VAL, RAND_MAX_VAL);
			Dt_Info.fCurYouya = Dt_Info.fCurLoad  * 0.1f;
			Dt_Info.nJiaZaiOrXieZai = LOAD_VALUE;
			int nCnt = 3;
			if (nL == nXunHuanCnt - 1)
			{
				nCnt = 4;
			}
			for (int j = 0; j < nCnt; ++j)
			{
				Dt_Info.nRecordId = j;
				Dt_Info.nTimeGap = Pro_Info.nLoadTimeList[j];
				ct += 60 * Dt_Info.nTimeGap;
				strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
				strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));

				fWeiyi += fGapWeiyi;
				Dt_Info.fWeiyiAvg = fWeiyi;
				for (int m = 0; m < nWeiYiCnt; ++m)
				{
					Dt_Info.fWeiyi[m] = fWeiyi;
				}
				vDataInfo.push_back(Dt_Info);
			}
			nBenjiId++;
		}

		nBenjiId = 0;
		//卸载数据
		//		fGapWeiyi = 0.02f;
		Dt_Info.nIdx = nBenjiId;
		Dt_Info.fLoadValue = nGapLoad ;
		Dt_Info.fCurLoad = Dt_Info.fLoadValue + GetRandVal(RAND_MIN_VAL, RAND_MAX_VAL);
		Dt_Info.fCurYouya = Dt_Info.fCurLoad  * 0.1f;
		Dt_Info.nJiaZaiOrXieZai = LOADOFF_VALUE;
		fWeiyi /= 2;
		for (int j = 0; j < 3; ++j)
		{
			Dt_Info.nRecordId = j;
			Dt_Info.nTimeGap = Pro_Info.nLoadOffTimeList[j];
			ct += 60 * Dt_Info.nTimeGap;
			strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
			strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));

			fWeiyi -= fGapWeiyi / 2;
			Dt_Info.fWeiyiAvg = fWeiyi;
			for (int m = 0; m < nWeiYiCnt; ++m)
			{
				Dt_Info.fWeiyi[m] = fWeiyi;
			}

			vDataInfo.push_back(Dt_Info);
		}
	}
	Pro_Info.nDataCnt = (int)vDataInfo.size();
}

void CMGData::CreateNewData_GF_GB_50007_2011_JB(MG_PROJECT_INFO &Pro_Info, vector<DATA_INFO> &vDataInfo)
{
	DATA_INFO Dt_Info;
	ZeroMemory(&Dt_Info, sizeof(DATA_INFO));
	Dt_Info.chBeiZhu[0] = '\0';
	USES_CONVERSION;
	CString strVal(L"");
	float fVal = 0;
	float fLastVal = 0; //上一级位移

	CTime ct;
	ct = CTime::GetCurrentTime();

	int nBenjiId = 0;
	float fWeiyi = 0;
	float nBegnLoad = 0, nEndLoad = 0;
	//初始拉力
	int nInitLoad = int(Pro_Info.nMaxLoad * Pro_Info.nChuShiHeZai / 100);
	int nHezai = Pro_Info.nChuShiHeZai;
	float fGapWeiyi = 0.05f;
	//根据循环加数据
	for (int i = 0; i < Pro_Info.chXunHuanCnt + 1; ++i)
	{
		vector<int> vLoad;
		vector<int> vLoadOff;

		if (0 == i)
		{
			Dt_Info.nRecordId = 0;
			Dt_Info.nIdx = 0;

			Dt_Info.fCurLoad = 0;
			Dt_Info.fLoadValue = 0;
			Dt_Info.nJiaZaiOrXieZai = LOAD_VALUE;
			Dt_Info.nTimeGap = Pro_Info.nLoadTimeList[0];

			strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
			strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));

			Dt_Info.fWeiyiAvg = 0;
			for (int m = 0; m < nWeiYiCnt; ++m)
			{
				Dt_Info.fWeiyi[m] = fWeiyi;
			}
			Dt_Info.fCurYouya = 0;

			fWeiyi = fGapWeiyi;
			vDataInfo.push_back(Dt_Info);
			continue;
		}
		else if (1 == i)
		{
			vLoad.push_back(nHezai);
			vLoad.push_back(30);
			vLoadOff.push_back(nHezai);
		}
		else if (2 == i)
		{
			vLoad.push_back(nHezai);
			vLoad.push_back(30);
			vLoad.push_back(50);
			vLoadOff.push_back(30);
			vLoadOff.push_back(nHezai);
		}
		else if (3 == i)
		{
			vLoad.push_back(nHezai);
			vLoad.push_back(30);
			vLoad.push_back(50);
			vLoad.push_back(70);
			vLoadOff.push_back(50);
			vLoadOff.push_back(30);
			vLoadOff.push_back(nHezai);
		}
		else if (4 == i)
		{
			vLoad.push_back(nHezai);
			vLoad.push_back(30);
			vLoad.push_back(50);
			vLoad.push_back(70);
			vLoad.push_back(80);
			vLoadOff.push_back(70);
			vLoadOff.push_back(50);
			vLoadOff.push_back(30);
			vLoadOff.push_back(nHezai);
		}
		else if (5 == i)
		{
			vLoad.push_back(nHezai);
			vLoad.push_back(30);
			vLoad.push_back(50);
			vLoad.push_back(80);
			vLoad.push_back(90);
			vLoadOff.push_back(80);
			vLoadOff.push_back(50);
			vLoadOff.push_back(30);
			vLoadOff.push_back(nHezai);
		}
		else if (6 == i)
		{
			vLoad.push_back(nHezai);
			vLoad.push_back(30);
			vLoad.push_back(50);
			vLoad.push_back(90);
			vLoad.push_back(100);
			vLoadOff.push_back(90);
			vLoadOff.push_back(50);
			vLoadOff.push_back(30);
			vLoadOff.push_back(nHezai);
		}
		else
		{
			vLoad.push_back(nHezai);
			vLoad.push_back(30);
			vLoad.push_back(50);
			vLoad.push_back(90 + (i - 6)*10);
			vLoad.push_back(100 + (i - 6) * 10);
			vLoadOff.push_back(+(i - 6) * 10);
			vLoadOff.push_back(50);
			vLoadOff.push_back(30);
			vLoadOff.push_back(nHezai);
		}


		//加载数据
		fGapWeiyi = 0.1f;
		nBenjiId = 1;
		for (int k = 0; k < (int)vLoad.size(); ++k)
		{
			int nLoad = int(Pro_Info.nMaxLoad * vLoad[k] / 100);
			Dt_Info.nIdx = nBenjiId;
			Dt_Info.fLoadValue = (float)nLoad;
			Dt_Info.fCurLoad = Dt_Info.fLoadValue + GetRandVal(RAND_MIN_VAL, RAND_MAX_VAL);
			Dt_Info.fCurYouya = Dt_Info.fCurLoad  * 0.1f;
			Dt_Info.nJiaZaiOrXieZai = LOAD_VALUE;
			int nTimes = 3;
			if (k == vLoad.size() - 1)
			{
				nTimes = 4;
			}
			for (int j = 0; j < nTimes; ++j)
			{
				Dt_Info.nRecordId = j;
				Dt_Info.nTimeGap = Pro_Info.nLoadTimeList[j];
				ct += 60 * Dt_Info.nTimeGap;
				strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
				strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));
				if (k != 0)
				{
					if (j == nTimes - 1)
					{
						fWeiyi += 0.09;
					}
					else
					{
						fWeiyi += fGapWeiyi - fGapWeiyi * j * 0.1f;
					}
				}

				Dt_Info.fWeiyiAvg = fWeiyi;
				for (int m = 0; m < nWeiYiCnt; ++m)
				{
					Dt_Info.fWeiyi[m] = fWeiyi;
				}
				vDataInfo.push_back(Dt_Info);
			}
			nBenjiId++;
		}

		nBenjiId = 0;
		//卸载数据
		for (int k = 0; k < (int)vLoadOff.size(); ++k)
		{
			int nLoad = int(Pro_Info.nMaxLoad * vLoadOff[k] / 100);
			Dt_Info.nIdx = nBenjiId;
			Dt_Info.fLoadValue = (float)nLoad;
			Dt_Info.fCurLoad = Dt_Info.fLoadValue + GetRandVal(RAND_MIN_VAL, RAND_MAX_VAL);
			Dt_Info.fCurYouya = Dt_Info.fCurLoad  * 0.1f;
			Dt_Info.nJiaZaiOrXieZai = LOADOFF_VALUE;
			//fWeiyi -= fGapWeiyi * 0.2;
			fWeiyi -= fGapWeiyi * 1.5;
			for (int j = 0; j < 3; ++j)
			{
				Dt_Info.nRecordId = j;
				Dt_Info.nTimeGap = Pro_Info.nLoadOffTimeList[j];
				ct += 60 * Dt_Info.nTimeGap;
				strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
				strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));

				Dt_Info.fWeiyiAvg = fWeiyi;
				for (int m = 0; m < nWeiYiCnt; ++m)
				{
					Dt_Info.fWeiyi[m] = fWeiyi;
				}

				vDataInfo.push_back(Dt_Info);
			}
			nBenjiId++;
		}
	}
	Pro_Info.nDataCnt = (int)vDataInfo.size();
}

//TB 10025-2019 锚杆基本试验
void CMGData::CreateNewData_TB_10025_2019_JB(MG_PROJECT_INFO &Pro_Info, vector<DATA_INFO> &vDataInfo)
{
	DATA_INFO Dt_Info;
	ZeroMemory(&Dt_Info, sizeof(DATA_INFO));
	Dt_Info.chBeiZhu[0] = '\0';
	USES_CONVERSION;
	CString strVal(L"");
	float fVal = 0;
	float fLastVal = 0; //上一级位移

	CTime ct;
	ct = CTime::GetCurrentTime();

	int nBenjiId = 0;
	float fWeiyi = 0;
	float nBegnLoad = 0, nEndLoad = 0;
	//初始拉力
	float nInitLoad = Pro_Info.nMaxLoad * Pro_Info.nChuShiHeZai / 100;
	float nGapLoad = Pro_Info.nMaxLoad * 0.2; //间隔拉力
	float fGapWeiyi = 0.02f;
	//根据循环加数据
	for (int i = 0; i < Pro_Info.chXunHuanCnt + 1; ++i)
	{
		if (0 == i)
		{
			Dt_Info.nRecordId = 0;
			Dt_Info.nIdx = 0;

			Dt_Info.fCurLoad = 0;
			Dt_Info.fLoadValue = 0;
			Dt_Info.nJiaZaiOrXieZai = LOAD_VALUE;
			Dt_Info.nTimeGap = Pro_Info.nLoadTimeList[0];

			strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
			strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));

			Dt_Info.fWeiyiAvg = 0;
			for (int m = 0; m < nWeiYiCnt; ++m)
			{
				Dt_Info.fWeiyi[m] = fWeiyi;
			}
			Dt_Info.fCurYouya = 0;

			vDataInfo.push_back(Dt_Info);
			continue;
		}
		else if (1 == i)
		{
			nBegnLoad = nInitLoad;
			nEndLoad = nBegnLoad + nGapLoad * 2;
		}
		else if (2 == i)
		{
			nBegnLoad = nInitLoad;
			nEndLoad = nBegnLoad + nGapLoad * 3;
		}
		else if (3 == i)
		{
			nBegnLoad = nInitLoad;
			nEndLoad = nBegnLoad + nGapLoad * 4;
		}
		else
		{
			nBegnLoad = nInitLoad;
			nEndLoad = nBegnLoad + nGapLoad * 5;
		}

		nBenjiId = 1;
		//加载数据
		fGapWeiyi = 0.03f;
		for (float nL = nBegnLoad; nL <= nEndLoad; nL += nGapLoad)
		{
			int nLoad = int(nL);
			if (nLoad >= Pro_Info.nMaxLoad)
			{
				nLoad = int(Pro_Info.nMaxLoad);
			}
			Dt_Info.nIdx = nBenjiId;
			Dt_Info.fCurLoad = (float)nLoad + GetRandVal(RAND_MIN_VAL, RAND_MAX_VAL);
			Dt_Info.fLoadValue = (float)nLoad;
			Dt_Info.fCurYouya = Dt_Info.fCurLoad  * 0.1f;
			Dt_Info.nJiaZaiOrXieZai = LOAD_VALUE;

			for (int j = 0; j < 4; ++j)
			{
				Dt_Info.nRecordId = j;
				Dt_Info.nTimeGap = Pro_Info.nLoadTimeList[j];
				ct += 60 * Dt_Info.nTimeGap;
				strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
				strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));

				fWeiyi += fGapWeiyi;
				Dt_Info.fWeiyiAvg = fWeiyi;
				for (int m = 0; m < nWeiYiCnt; ++m)
				{
					Dt_Info.fWeiyi[m] = fWeiyi;
				}
				vDataInfo.push_back(Dt_Info);
			}
			nBenjiId++;
		}

		nBenjiId = 0;
		//卸载数据
		fGapWeiyi = 0.02f;
		for (float nL = nEndLoad - nGapLoad; nL >= nInitLoad; nL -= nGapLoad)
		{
			Dt_Info.nIdx = nBenjiId;
			Dt_Info.fCurLoad = nL + GetRandVal(RAND_MIN_VAL, RAND_MAX_VAL);
			Dt_Info.fLoadValue = nL;
			Dt_Info.fCurYouya = nL * 0.1f;
			Dt_Info.nJiaZaiOrXieZai = LOADOFF_VALUE;

			for (int j = 0; j < 3; ++j)
			{
				Dt_Info.nRecordId = j;
				Dt_Info.nTimeGap = Pro_Info.nLoadOffTimeList[j];
				ct += 60 * Dt_Info.nTimeGap;
				strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
				strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));

				fWeiyi -= fGapWeiyi / 2;
				Dt_Info.fWeiyiAvg = fWeiyi;
				for (int m = 0; m < nWeiYiCnt; ++m)
				{
					Dt_Info.fWeiyi[m] = fWeiyi;
				}

				vDataInfo.push_back(Dt_Info);
			}
			nBenjiId++;
		}
	}
	Pro_Info.nDataCnt = (int)vDataInfo.size();
}

//TB 10025-2019 锚杆单循环验收试验
void CMGData::CreateNewData_TB_10025_2019_YS_S(MG_PROJECT_INFO &Pro_Info, vector<DATA_INFO> &vDataInfo)
{
	DATA_INFO Dt_Info;
	ZeroMemory(&Dt_Info, sizeof(DATA_INFO));
	Dt_Info.chBeiZhu[0] = '\0';
	USES_CONVERSION;
	CString strVal(L"");
	float fVal = 0;
	float fLastVal = 0; //上一级位移

	CTime ct;
	ct = CTime::GetCurrentTime();

	int nBenjiId = 0;
	float fWeiyi = 0;
	float nBegnLoad = 0, nEndLoad = 0;
	float nMaxLoad = Pro_Info.nMaxLoad;
	if (Pro_Info.chMaoGanType == 0)
	{
		nMaxLoad = nMaxLoad * 1.5;
	}
	else
	{
		nMaxLoad = nMaxLoad * 1.2;
	}
	//初始拉力
	int nInitLoad = int(nMaxLoad* Pro_Info.nChuShiHeZai / 100);
	float fGapWeiyi = 0.2f;
	vector<int> vLoad;
	vLoad.push_back(nMaxLoad * 0.1);
	vLoad.push_back(nMaxLoad * 0.4);
	vLoad.push_back(nMaxLoad * 0.7);
	vLoad.push_back(nMaxLoad * 1);
	int nXunHuanCnt = 4;
	//根据循环加数据
	for (int i = 0; i < 2; ++i)
	{
		if (0 == i)
		{
			Dt_Info.nRecordId = 0;
			Dt_Info.nIdx = 0;

			Dt_Info.fCurLoad = 0;
			Dt_Info.fLoadValue = 0;
			Dt_Info.nJiaZaiOrXieZai = LOAD_VALUE;
			Dt_Info.nTimeGap = Pro_Info.nLoadTimeList[0];

			strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
			strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));

			Dt_Info.fWeiyiAvg = 0;
			for (int m = 0; m < nWeiYiCnt; ++m)
			{
				Dt_Info.fWeiyi[m] = fWeiyi;
			}
			Dt_Info.fCurYouya = 0;

			vDataInfo.push_back(Dt_Info);
			continue;
		}
		nBenjiId = 1;
		//加载数据
		//		fGapWeiyi = 0.2f;
		int nLoad = nInitLoad;
		for (int nL = 0; nL < nXunHuanCnt; nL++)
		{
			nLoad = vLoad[nL];

			Dt_Info.nIdx = nBenjiId;
			//Dt_Info.fCurLoad = (float)nLoad;
			Dt_Info.fCurLoad = (float)nLoad + GetRandVal(RAND_MIN_VAL, RAND_MAX_VAL);
			Dt_Info.fLoadValue = (float)nLoad;
			Dt_Info.fCurYouya = Dt_Info.fCurLoad  * 0.1f;
			Dt_Info.nJiaZaiOrXieZai = LOAD_VALUE;
			int nCnt = 2;
			if (nL == nXunHuanCnt - 1)
			{
				nCnt = 4;
			}
			for (int j = 0; j < nCnt; ++j)
			{
				Dt_Info.nRecordId = j;
				Dt_Info.nTimeGap = Pro_Info.nLoadTimeList[j];
				ct += 60 * Dt_Info.nTimeGap;
				strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
				strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));

				fWeiyi += fGapWeiyi;
				Dt_Info.fWeiyiAvg = fWeiyi;
				for (int m = 0; m < nWeiYiCnt; ++m)
				{
					Dt_Info.fWeiyi[m] = fWeiyi;
				}
				vDataInfo.push_back(Dt_Info);
			}
			nBenjiId++;
		}

		nBenjiId = 0;
		for (int nL = nXunHuanCnt - 2; nL >= 0; nL--)
		{
			nLoad = vLoad[nL];

			//卸载数据
			Dt_Info.nIdx = nBenjiId;
			Dt_Info.fCurLoad = (float)nLoad + GetRandVal(RAND_MIN_VAL, RAND_MAX_VAL);
			Dt_Info.fLoadValue = (float)nLoad;
// 			Dt_Info.fCurLoad = (float)nLoad;
// 			Dt_Info.fLoadValue = Dt_Info.fCurLoad;
			Dt_Info.fCurYouya = Dt_Info.fCurLoad  * 0.1f;
			Dt_Info.nJiaZaiOrXieZai = LOADOFF_VALUE;
			for (int j = 0; j < 2; ++j)
			{
				Dt_Info.nRecordId = j;
				Dt_Info.nTimeGap = Pro_Info.nLoadOffTimeList[j];
				ct += 60 * Dt_Info.nTimeGap;
				strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
				strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));

				fWeiyi -= fGapWeiyi / 2 * j;
				Dt_Info.fWeiyiAvg = fWeiyi;
				for (int m = 0; m < nWeiYiCnt; ++m)
				{
					Dt_Info.fWeiyi[m] = fWeiyi;
				}

				vDataInfo.push_back(Dt_Info);
			}
			nBenjiId++;
		}
	}
	Pro_Info.nDataCnt = (int)vDataInfo.size();
}
//TB 10025-2019 锚杆多循环验收试验
void CMGData::CreateNewData_TB_10025_2019_YS_D(MG_PROJECT_INFO &Pro_Info, vector<DATA_INFO> &vDataInfo)
{
	DATA_INFO Dt_Info;
	ZeroMemory(&Dt_Info, sizeof(DATA_INFO));
	Dt_Info.chBeiZhu[0] = '\0';
	USES_CONVERSION;
	CString strVal(L"");
	float fVal = 0;
	float fLastVal = 0; //上一级位移

	CTime ct;
	ct = CTime::GetCurrentTime();

	int nBenjiId = 0;
	float fWeiyi = 0;
	float nBegnLoad = 0, nEndLoad = 0;
	//永久锚杆1.5倍最大拉力  临时锚杆1.2倍最大拉力
	float nMaxLoad = Pro_Info.nMaxLoad;
	if (Pro_Info.chMaoGanType == 0)
	{
		nMaxLoad = int(nMaxLoad * 1.5);
	}
	else
	{
		nMaxLoad = int(nMaxLoad * 1.2);
	}
	//初始拉力
	int nInitLoad = int(nMaxLoad * Pro_Info.nChuShiHeZai / 100);
	int nHezai = Pro_Info.nChuShiHeZai;
	float fGapWeiyi = 0.2f;
	//根据循环加数据
	for (int i = 0; i < Pro_Info.chXunHuanCnt + 1; ++i)
	{
		vector<int> vLoad;
		vector<int> vLoadOff;

		if (0 == i)
		{
			Dt_Info.nRecordId = 0;
			Dt_Info.nIdx = 0;

			Dt_Info.fCurLoad = 0;
			Dt_Info.fLoadValue = 0;
			Dt_Info.nJiaZaiOrXieZai = LOAD_VALUE;
			Dt_Info.nTimeGap = Pro_Info.nLoadTimeList[0];

			strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
			strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));

			Dt_Info.fWeiyiAvg = 0;
			for (int m = 0; m < nWeiYiCnt; ++m)
			{
				Dt_Info.fWeiyi[m] = fWeiyi;
			}
			Dt_Info.fCurYouya = 0;

			fWeiyi = fGapWeiyi;
			vDataInfo.push_back(Dt_Info);
			continue;
		}
		else if (1 == i)
		{
			vLoad.push_back(nHezai);
			vLoad.push_back(40);
			vLoadOff.push_back(nHezai);
		}
		else if (2 == i)
		{
			vLoad.push_back(nHezai);
			vLoad.push_back(40);
			vLoad.push_back(60);
			vLoadOff.push_back(40);
			vLoadOff.push_back(nHezai);
		}
		else if (3 == i)
		{
			vLoad.push_back(nHezai);
			vLoad.push_back(40);
			vLoad.push_back(60);
			vLoad.push_back(80);
			vLoadOff.push_back(60);
			vLoadOff.push_back(40);
			vLoadOff.push_back(nHezai);
		}
		else if (4 == i)
		{
			vLoad.push_back(nHezai);
			vLoad.push_back(40);
			vLoad.push_back(60);
			vLoad.push_back(80);
			vLoad.push_back(100);
			vLoadOff.push_back(80);
			vLoadOff.push_back(60);
			vLoadOff.push_back(40);
			vLoadOff.push_back(nHezai);
		}
		else
		{
			vLoad.push_back(nHezai);
			vLoad.push_back(40);
			vLoad.push_back(60);
			vLoad.push_back(80);
			vLoad.push_back(100);

			if (Pro_Info.chMaoGanType == 0)
			{
				vLoad.push_back(120);
			}
			else
			{
				vLoad.push_back(110);
			}
			vLoadOff.push_back(100);
			vLoadOff.push_back(80);
			vLoadOff.push_back(60);
			vLoadOff.push_back(40);
			vLoadOff.push_back(nHezai);
		}



		//加载数据
		fGapWeiyi = 0.1f;
		nBenjiId = 1;
		for (int k = 0; k < (int)vLoad.size(); ++k)
		{
			int nLoad = int(nMaxLoad * vLoad[k] / 100);
			Dt_Info.nIdx = nBenjiId;
			Dt_Info.fCurLoad = (float)nLoad + GetRandVal(RAND_MIN_VAL, RAND_MAX_VAL);
			Dt_Info.fLoadValue = (float)nLoad;
			Dt_Info.fCurYouya = Dt_Info.fCurLoad  * 0.1f;
			Dt_Info.nJiaZaiOrXieZai = LOAD_VALUE;
			int nTimes = 2;
			if (k == vLoad.size() - 1)
			{
				nTimes = 5;
			}
			for (int j = 0; j < nTimes; ++j)
			{
				Dt_Info.nRecordId = j;
				Dt_Info.nTimeGap = Pro_Info.nLoadTimeList[j];
				ct += 60 * Dt_Info.nTimeGap;
				strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
				strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));
				if (k != 0)
				{
					if (j == nTimes - 1)
					{
						fWeiyi += 0.09;
					}
					else
					{
						fWeiyi += fGapWeiyi - fGapWeiyi * j * 0.1f;
					}
				}

				Dt_Info.fWeiyiAvg = fWeiyi;
				for (int m = 0; m < nWeiYiCnt; ++m)
				{
					Dt_Info.fWeiyi[m] = fWeiyi;
				}
				vDataInfo.push_back(Dt_Info);
			}
			nBenjiId++;
		}

		nBenjiId = 0;
		//卸载数据
		for (int k = 0; k < (int)vLoadOff.size(); ++k)
		{
			int nLoad = int(nMaxLoad * vLoadOff[k] / 100);
			Dt_Info.nIdx = nBenjiId;
			Dt_Info.fCurLoad = (float)nLoad + GetRandVal(RAND_MIN_VAL, RAND_MAX_VAL);
			Dt_Info.fLoadValue = (float)nLoad;
// 			Dt_Info.fCurLoad = (float)nLoad;
// 			Dt_Info.fLoadValue = Dt_Info.fCurLoad;
			Dt_Info.fCurYouya = Dt_Info.fCurLoad  * 0.1f;
			Dt_Info.nJiaZaiOrXieZai = LOADOFF_VALUE;
			fWeiyi -= fGapWeiyi * 1.2;
			for (int j = 0; j < 2; ++j)
			{
				Dt_Info.nRecordId = j;
				Dt_Info.nTimeGap = Pro_Info.nLoadOffTimeList[j];
				ct += 60 * Dt_Info.nTimeGap;
				strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
				strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));

				Dt_Info.fWeiyiAvg = fWeiyi;
				for (int m = 0; m < nWeiYiCnt; ++m)
				{
					Dt_Info.fWeiyi[m] = fWeiyi;
				}

				vDataInfo.push_back(Dt_Info);
			}
			nBenjiId++;
		}
	}
	Pro_Info.nDataCnt = (int)vDataInfo.size();
}

//GB50086-2015 锚杆多循环验收试验
void CMGData::CreateNewData_GB50086_2015_YS_D(MG_PROJECT_INFO &Pro_Info, vector<DATA_INFO> &vDataInfo)
{
	DATA_INFO Dt_Info;
	ZeroMemory(&Dt_Info, sizeof(DATA_INFO));
	Dt_Info.chBeiZhu[0] = '\0';
	USES_CONVERSION;
	CString strVal(L"");
	float fVal = 0;
	float fLastVal = 0; //上一级位移

	CTime ct;
	ct = CTime::GetCurrentTime();

	int nBenjiId = 0;
	float fWeiyi = 0;
	float nBegnLoad = 0, nEndLoad = 0;
	//初始拉力
	int nInitLoad = int(Pro_Info.nMaxLoad * Pro_Info.nChuShiHeZai / 100);
	int nHezai = Pro_Info.nChuShiHeZai;
	float fGapWeiyi = 0.2f;
	//根据循环加数据
	for (int i = 0; i < Pro_Info.chXunHuanCnt + 1; ++i)
	{
		vector<int> vLoad;
		vector<int> vLoadOff;

		if (0 == i)
		{
			Dt_Info.nRecordId = 0;
			Dt_Info.nIdx = 0;

			Dt_Info.fCurLoad = 0;
			Dt_Info.fLoadValue = 0;
			Dt_Info.nJiaZaiOrXieZai = LOAD_VALUE;
			Dt_Info.nTimeGap = Pro_Info.nLoadTimeList[0];

			strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
			strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));

			Dt_Info.fWeiyiAvg = 0;
			for (int m = 0; m < nWeiYiCnt; ++m)
			{
				Dt_Info.fWeiyi[m] = fWeiyi;
			}
			Dt_Info.fCurYouya = 0;

			fWeiyi = fGapWeiyi;
			vDataInfo.push_back(Dt_Info);
			continue;
		}
		else if (1 == i)
		{
			vLoad.push_back(nHezai);
			vLoad.push_back(40);
			vLoadOff.push_back(nHezai);
		}
		else if (2 == i)
		{
			vLoad.push_back(nHezai);
			vLoad.push_back(40);
			vLoad.push_back(60);
			vLoadOff.push_back(40);
			vLoadOff.push_back(nHezai);
		}
		else if (3 == i)
		{
			vLoad.push_back(nHezai);
			vLoad.push_back(40);
			vLoad.push_back(60);
			vLoad.push_back(80);
			vLoadOff.push_back(60);
			vLoadOff.push_back(40);
			vLoadOff.push_back(nHezai);
		}
		else if (4 == i)
		{
			vLoad.push_back(nHezai);
			vLoad.push_back(40);
			vLoad.push_back(60);
			vLoad.push_back(80);
			vLoad.push_back(100);
			vLoadOff.push_back(80);
			vLoadOff.push_back(60);
			vLoadOff.push_back(40);
			vLoadOff.push_back(nHezai);
		}
		else
		{
			vLoad.push_back(nHezai);
			vLoad.push_back(40);
			vLoad.push_back(60);
			vLoad.push_back(80);
			vLoad.push_back(100);
		
			if (Pro_Info.chMaoGanType == 0)
			{
				vLoad.push_back(120);
			}
			else
			{
				vLoad.push_back(110);
			}
			vLoadOff.push_back(100);
			vLoadOff.push_back(80);
			vLoadOff.push_back(60);
			vLoadOff.push_back(40);
			vLoadOff.push_back(nHezai);
		}



		//加载数据
		fGapWeiyi = 0.1f;
		nBenjiId = 1;
		for (int k = 0; k < (int)vLoad.size(); ++k)
		{
			int nLoad = int(Pro_Info.nMaxLoad * vLoad[k] / 100);
			Dt_Info.nIdx = nBenjiId;
			Dt_Info.fCurLoad = (float)nLoad + GetRandVal(RAND_MIN_VAL, RAND_MAX_VAL);
			Dt_Info.fLoadValue = (float)nLoad;
			Dt_Info.fCurYouya = (float)nLoad  * 0.1f;
			Dt_Info.nJiaZaiOrXieZai = LOAD_VALUE;
			int nTimes = 2;
			if (k == vLoad.size() - 1)
			{
				nTimes = 5;
			}
			for (int j = 0; j < nTimes; ++j)
			{
				Dt_Info.nRecordId = j;
				Dt_Info.nTimeGap = Pro_Info.nLoadTimeList[j];
				ct += 60 * Dt_Info.nTimeGap;
				strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
				strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));
				if (k != 0)
				{
					if (j == nTimes - 1)
					{
						fWeiyi += 0.09;
					}
					else
					{
						fWeiyi += fGapWeiyi - fGapWeiyi * j * 0.1f;
					}
				}

				Dt_Info.fWeiyiAvg = fWeiyi;
				for (int m = 0; m < nWeiYiCnt; ++m)
				{
					Dt_Info.fWeiyi[m] = fWeiyi;
				}
				vDataInfo.push_back(Dt_Info);
			}
			nBenjiId++;
		}

		nBenjiId = 0;
		//卸载数据
		for (int k = 0; k < (int)vLoadOff.size(); ++k)
		{
			int nLoad = int(Pro_Info.nMaxLoad * vLoadOff[k] / 100);
			Dt_Info.nIdx = nBenjiId;
			Dt_Info.fCurLoad = (float)nLoad + GetRandVal(RAND_MIN_VAL, RAND_MAX_VAL);
			Dt_Info.fLoadValue = (float)nLoad;
			Dt_Info.fCurYouya = (float)nLoad   * 0.1f;
			Dt_Info.nJiaZaiOrXieZai = LOADOFF_VALUE;
			fWeiyi -= fGapWeiyi * 1.2;
			for (int j = 0; j < 2; ++j)
			{
				Dt_Info.nRecordId = j;
				Dt_Info.nTimeGap = Pro_Info.nLoadOffTimeList[j];
				ct += 60 * Dt_Info.nTimeGap;
				strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
				strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));

				Dt_Info.fWeiyiAvg = fWeiyi;
				for (int m = 0; m < nWeiYiCnt; ++m)
				{
					Dt_Info.fWeiyi[m] = fWeiyi;
				}

				vDataInfo.push_back(Dt_Info);
			}
			nBenjiId++;
		}
	}
	Pro_Info.nDataCnt = (int)vDataInfo.size();
}

//GB50086-2015 锚杆单循环验收试验
void CMGData::CreateNewData_GB50086_2015_YS_S(MG_PROJECT_INFO &Pro_Info, vector<DATA_INFO> &vDataInfo)
{
	DATA_INFO Dt_Info;
	ZeroMemory(&Dt_Info, sizeof(DATA_INFO));
	Dt_Info.chBeiZhu[0] = '\0';
	USES_CONVERSION;
	CString strVal(L"");
	float fVal = 0;
	float fLastVal = 0; //上一级位移

	CTime ct;
	ct = CTime::GetCurrentTime();

	int nBenjiId = 0;
	float fWeiyi = 0;
	float nBegnLoad = 0, nEndLoad = 0;
	//初始拉力
	int nInitLoad = int(Pro_Info.nMaxLoad * Pro_Info.nChuShiHeZai / 100);
	float fGapWeiyi = 0.2f;
	int nXunHuanCnt = 5;
	vector<int> vLoad;
	vLoad.push_back(Pro_Info.nMaxLoad * 0.1);
	vLoad.push_back(Pro_Info.nMaxLoad * 0.4);
	vLoad.push_back(Pro_Info.nMaxLoad * 0.7);
	vLoad.push_back(Pro_Info.nMaxLoad * 1);
	if (Pro_Info.chMaoGanType == 0)
	{
		vLoad.push_back(Pro_Info.nMaxLoad * 1.2);
	}
	else
	{
		vLoad.push_back(Pro_Info.nMaxLoad * 1.1);
	}

	//根据循环加数据
	for (int i = 0; i < 2; ++i)
	{
		if (0 == i)
		{
			Dt_Info.nRecordId = 0;
			Dt_Info.nIdx = 0;

			Dt_Info.fCurLoad = 0;
			Dt_Info.fLoadValue = 0;
			Dt_Info.nJiaZaiOrXieZai = LOAD_VALUE;
			Dt_Info.nTimeGap = Pro_Info.nLoadTimeList[0];

			strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
			strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));

			Dt_Info.fWeiyiAvg = 0;
			for (int m = 0; m < nWeiYiCnt; ++m)
			{
				Dt_Info.fWeiyi[m] = fWeiyi;
			}
			Dt_Info.fCurYouya = 0;

			vDataInfo.push_back(Dt_Info);
			continue;
		}
		nBenjiId = 1;
		//加载数据
		//		fGapWeiyi = 0.2f;
		int nLoad = nInitLoad;
		for (int nL = 0; nL < nXunHuanCnt; nL++)
		{
			nLoad = vLoad[nL];

			Dt_Info.nIdx = nBenjiId;
			Dt_Info.fCurLoad = (float)nLoad + GetRandVal(RAND_MIN_VAL, RAND_MAX_VAL);
			Dt_Info.fLoadValue = (float)nLoad;
			Dt_Info.fCurYouya = (float)nLoad * 0.1f;
			Dt_Info.nJiaZaiOrXieZai = LOAD_VALUE;
			int nCnt = 2;
			if (nL == nXunHuanCnt - 1)
			{
				nCnt = 4;
			}
			for (int j = 0; j < nCnt; ++j)
			{
				Dt_Info.nRecordId = j;
				Dt_Info.nTimeGap = Pro_Info.nLoadTimeList[j];
				ct += 60 * Dt_Info.nTimeGap;
				strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
				strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));

				fWeiyi += fGapWeiyi;
				Dt_Info.fWeiyiAvg = fWeiyi;
				for (int m = 0; m < nWeiYiCnt; ++m)
				{
					Dt_Info.fWeiyi[m] = fWeiyi;
				}
				vDataInfo.push_back(Dt_Info);
			}
			nBenjiId++;
		}

		nBenjiId = 0;
		for (int nL = nXunHuanCnt - 2; nL >= 0; nL--)
		{
			nLoad = vLoad[nL];
			
			//卸载数据
			Dt_Info.nIdx = nBenjiId;
			Dt_Info.fCurLoad = (float)nLoad + GetRandVal(RAND_MIN_VAL, RAND_MAX_VAL);
			Dt_Info.fLoadValue = (float)nLoad;
			Dt_Info.fCurYouya = (float)nLoad * 0.1f;
			Dt_Info.nJiaZaiOrXieZai = LOADOFF_VALUE;
			for (int j = 0; j < 2; ++j)
			{
				Dt_Info.nRecordId = j;
				Dt_Info.nTimeGap = Pro_Info.nLoadOffTimeList[j];
				ct += 60 * Dt_Info.nTimeGap;
				strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
				strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));

				fWeiyi -= fGapWeiyi / 2 * j;
				Dt_Info.fWeiyiAvg = fWeiyi;
				for (int m = 0; m < nWeiYiCnt; ++m)
				{
					Dt_Info.fWeiyi[m] = fWeiyi;
				}

				vDataInfo.push_back(Dt_Info);
			}
			nBenjiId++;
		}		
	}
	Pro_Info.nDataCnt = (int)vDataInfo.size();
}

//GB50086-2015 锚杆基本试验
void CMGData::CreateNewData_GB50086_2015_JB(MG_PROJECT_INFO &Pro_Info, vector<DATA_INFO> &vDataInfo)
{
	DATA_INFO Dt_Info;
	ZeroMemory(&Dt_Info, sizeof(DATA_INFO));
	Dt_Info.chBeiZhu[0] = '\0';
	USES_CONVERSION;
	CString strVal(L"");
	float fVal = 0;
	float fLastVal = 0; //上一级位移

	CTime ct;
	ct = CTime::GetCurrentTime();

	int nBenjiId = 0;
	float fWeiyi = 0;
	float nBegnLoad = 0, nEndLoad = 0;
	//初始拉力
	int nInitLoad = int(Pro_Info.nMaxLoad * Pro_Info.nChuShiHeZai / 100);
	int nHezai = Pro_Info.nChuShiHeZai;
	float fGapWeiyi = 0.05f;
	//根据循环加数据
	vector<int> vLoad;
	vLoad.push_back(nHezai);
	vector<int> vLoadOff;
	vLoadOff.push_back(nHezai);
	for (int i = 0; i < Pro_Info.chXunHuanCnt + 1; ++i)
	{
		if (0 == i)
		{
			Dt_Info.nRecordId = 0;
			Dt_Info.nIdx = 0;

			Dt_Info.fCurLoad = 0;
			Dt_Info.fLoadValue = 0;
			Dt_Info.nJiaZaiOrXieZai = LOAD_VALUE;
			Dt_Info.nTimeGap = Pro_Info.nLoadTimeList[0];

			strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
			strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));

			Dt_Info.fWeiyiAvg = 0;
			for (int m = 0; m < nWeiYiCnt; ++m)
			{
				Dt_Info.fWeiyi[m] = fWeiyi;
			}
			Dt_Info.fCurYouya = 0;

			fWeiyi = fGapWeiyi;
			vDataInfo.push_back(Dt_Info);
			continue;
		}
		else if (1 == i)
		{
			vLoad.push_back(30);		
		}
		else if (2 == i)
		{
			vLoad.push_back(50);
		}
		else if (3 == i)
		{
			vLoad.push_back(60);
		}
		else if (4 == i)
		{
			vLoad.push_back(70);
		}
		else if (5 == i)
		{
			vLoad.push_back(80);
		}
		else if (6 == i)
		{
			vLoad.push_back(90);
		}
		else if (7 == i)
		{
			vLoad.push_back(100);
		}

		//加载数据
		fGapWeiyi = 0.1f;
		nBenjiId = 1;
		for (int k = 0; k < (int)vLoad.size(); ++k)
		{
			int nLoad = int(Pro_Info.nMaxLoad * vLoad[k] / 100);
			Dt_Info.nIdx = nBenjiId;
			Dt_Info.fCurLoad = (float)nLoad + GetRandVal(RAND_MIN_VAL, RAND_MAX_VAL);
			Dt_Info.fLoadValue = (float)nLoad;
			Dt_Info.fCurYouya = (float)nLoad  * 0.1f;
			Dt_Info.nJiaZaiOrXieZai = LOAD_VALUE;
			int nTimes = 2;
			if (k == vLoad.size() - 1)
			{
				nTimes = 4;
			}
			for (int j = 0; j < nTimes; ++j)
			{
				Dt_Info.nRecordId = j;
				Dt_Info.nTimeGap = Pro_Info.nLoadTimeList[j];
				ct += 60 * Dt_Info.nTimeGap;
				strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
				strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));
				if (k != 0)
				{
					if (j == nTimes - 1)
					{
						fWeiyi += 0.09;
					}
					else
					{
						fWeiyi += fGapWeiyi - fGapWeiyi * j * 0.2f;
					}
				}

				Dt_Info.fWeiyiAvg = fWeiyi;
				for (int m = 0; m < nWeiYiCnt; ++m)
				{
					Dt_Info.fWeiyi[m] = fWeiyi;
				}
				vDataInfo.push_back(Dt_Info);
			}
			nBenjiId++;
		}

		nBenjiId = 0;
		//卸载数据
		for (int k = 0; k < (int)vLoadOff.size(); ++k)
		{
			int nLoad = int(Pro_Info.nMaxLoad * vLoadOff[k] / 100);
			Dt_Info.nIdx = nBenjiId;
			Dt_Info.fCurLoad = (float)nLoad + GetRandVal(RAND_MIN_VAL, RAND_MAX_VAL);
			Dt_Info.fLoadValue = (float)nLoad;
			Dt_Info.fCurYouya = (float)nLoad  * 0.1f;
			Dt_Info.nJiaZaiOrXieZai = LOADOFF_VALUE;
			fWeiyi  /= 1.5;
			for (int j = 0; j < 2; ++j)
			{
				Dt_Info.nRecordId = j;
				Dt_Info.nTimeGap = Pro_Info.nLoadOffTimeList[j];
				ct += 60 * Dt_Info.nTimeGap;
				strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
				strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));

				Dt_Info.fWeiyiAvg = fWeiyi;
				for (int m = 0; m < nWeiYiCnt; ++m)
				{
					Dt_Info.fWeiyi[m] = fWeiyi;
				}

				vDataInfo.push_back(Dt_Info);
			}
			nBenjiId++;
		}
	}
	Pro_Info.nDataCnt = (int)vDataInfo.size();
}

void CMGData::CreateNewData_CECS_22_2005_YS(MG_PROJECT_INFO &Pro_Info, vector<DATA_INFO> &vDataInfo)
{
	DATA_INFO Dt_Info;
	ZeroMemory(&Dt_Info, sizeof(DATA_INFO));
	Dt_Info.chBeiZhu[0] = '\0';
	USES_CONVERSION;
	CString strVal(L"");
	float fVal = 0;
	float fLastVal = 0; //上一级位移

	CTime ct;
	ct = CTime::GetCurrentTime();

	int nBenjiId = 0;
	float fWeiyi = 0;
	float nBegnLoad = 0, nEndLoad = 0;
	//初始拉力
	int nInitLoad = int(Pro_Info.nMaxLoad * Pro_Info.nChuShiHeZai / 100);
	/*float nGapLoad = Pro_Info.nMaxLoad / 10; //间隔拉力*/
	float fGapWeiyi = 0.02f;
	int nXunHuanCnt = 5;
	//永久锚杆7级  临时锚杆5级
	if (Pro_Info.chMaoGanType == 0)
	{
		nXunHuanCnt = 7;
	}
	vector<int> vLoad;
	vLoad.push_back(Pro_Info.nMaxLoad * 0.1);
	vLoad.push_back(Pro_Info.nMaxLoad * 0.5);
	vLoad.push_back(Pro_Info.nMaxLoad * 0.75);
	vLoad.push_back(Pro_Info.nMaxLoad * 1);
	vLoad.push_back(Pro_Info.nMaxLoad * 1.2);
	vLoad.push_back(Pro_Info.nMaxLoad * 1.33);
	vLoad.push_back(Pro_Info.nMaxLoad * 1.5);

	//根据循环加数据
	for (int i = 0; i < 2; ++i)
	{
		if (0 == i)
		{
			Dt_Info.nRecordId = 0;
			Dt_Info.nIdx = 0;

			Dt_Info.fCurLoad = 0;
			Dt_Info.fLoadValue = 0;
			Dt_Info.nJiaZaiOrXieZai = LOAD_VALUE;
			Dt_Info.nTimeGap = Pro_Info.nLoadTimeList[0];

			strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
			strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));

			Dt_Info.fWeiyiAvg = 0;
			for (int m = 0; m < nWeiYiCnt; ++m)
			{
				Dt_Info.fWeiyi[m] = fWeiyi;
			}
			Dt_Info.fCurYouya = 0;

			vDataInfo.push_back(Dt_Info);
			continue;
		}
		nBenjiId = 1;
		//加载数据
		//		fGapWeiyi = 0.2f;
		int nLoad = nInitLoad;
		for (float nL = 0; nL < nXunHuanCnt; nL++)
		{
			nLoad = vLoad[nL];

			Dt_Info.nIdx = nBenjiId;
			Dt_Info.fCurLoad = (float)nLoad + GetRandVal(RAND_MIN_VAL, RAND_MAX_VAL);
			Dt_Info.fLoadValue = (float)nLoad;
			Dt_Info.fCurYouya = (float)nLoad  * 0.1f;
			Dt_Info.nJiaZaiOrXieZai = LOAD_VALUE;
			int nCnt = 3;
			if (nL == nXunHuanCnt - 1)
			{
				nCnt = 4;
			}
			for (int j = 0; j < nCnt; ++j)
			{
				Dt_Info.nRecordId = j;
				Dt_Info.nTimeGap = Pro_Info.nLoadTimeList[j];
				ct += 60 * Dt_Info.nTimeGap;
				strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
				strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));

				fWeiyi += fGapWeiyi;
				Dt_Info.fWeiyiAvg = fWeiyi;
				for (int m = 0; m < nWeiYiCnt; ++m)
				{
					Dt_Info.fWeiyi[m] = fWeiyi;
				}
				vDataInfo.push_back(Dt_Info);
			}
			nBenjiId++;
		}

		nBenjiId = 0;
		//卸载数据
		Dt_Info.nIdx = nBenjiId;
		Dt_Info.fCurLoad = (float)nInitLoad + GetRandVal(RAND_MIN_VAL, RAND_MAX_VAL);
		Dt_Info.fLoadValue = (float)nInitLoad;
		Dt_Info.fCurYouya = (float)nInitLoad* 0.1f;
		Dt_Info.nJiaZaiOrXieZai = LOADOFF_VALUE;
		fWeiyi /= 2;
		for (int j = 0; j < 3; ++j)
		{
			Dt_Info.nRecordId = j;
			Dt_Info.nTimeGap = Pro_Info.nLoadOffTimeList[j];
			ct += 60 * Dt_Info.nTimeGap;
			strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
			strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));

			fWeiyi -= fGapWeiyi / 2;
			Dt_Info.fWeiyiAvg = fWeiyi;
			for (int m = 0; m < nWeiYiCnt; ++m)
			{
				Dt_Info.fWeiyi[m] = fWeiyi;
			}

			vDataInfo.push_back(Dt_Info);
		}

		//反弹
		nBenjiId++;
		Dt_Info.nIdx = nBenjiId;
		Dt_Info.fCurLoad = (float)vLoad[3];
		Dt_Info.fLoadValue = Dt_Info.fCurLoad;
		Dt_Info.fCurYouya = Dt_Info.fCurLoad  * 0.1f;
		Dt_Info.nJiaZaiOrXieZai = LOAD_VALUE;
		for (int j = 0; j < 3; ++j)
		{
			Dt_Info.nRecordId = j;
			Dt_Info.nTimeGap = Pro_Info.nLoadOffTimeList[j];
			ct += 60 * Dt_Info.nTimeGap;
			strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
			strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));

			fWeiyi += fGapWeiyi * 1.5;
			Dt_Info.fWeiyiAvg = fWeiyi;
			for (int m = 0; m < nWeiYiCnt; ++m)
			{
				Dt_Info.fWeiyi[m] = fWeiyi;
			}

			vDataInfo.push_back(Dt_Info);
		}
	}
	Pro_Info.nDataCnt = (int)vDataInfo.size();
}

void CMGData::CreateNewData_CECS_22_2005_JB(MG_PROJECT_INFO &Pro_Info, vector<DATA_INFO> &vDataInfo)
{
	DATA_INFO Dt_Info;
	ZeroMemory(&Dt_Info, sizeof(DATA_INFO));
	Dt_Info.chBeiZhu[0] = '\0';
	USES_CONVERSION;
	CString strVal(L"");
	float fVal = 0;
	float fLastVal = 0; //上一级位移

	CTime ct;
	ct = CTime::GetCurrentTime();

	int nBenjiId = 0;
	float fWeiyi = 0;
	float nBegnLoad = 0, nEndLoad = 0;
	//初始拉力
	int nInitLoad = int(Pro_Info.nMaxLoad * Pro_Info.nChuShiHeZai / 100);
	int nHezai = Pro_Info.nChuShiHeZai;
	float fGapWeiyi = 0.05f;
	//根据循环加数据
	for (int i = 0; i < Pro_Info.chXunHuanCnt + 1; ++i)
	{
		vector<int> vLoad;
		vector<int> vLoadOff;

		if (0 == i)
		{
			Dt_Info.nRecordId = 0;
			Dt_Info.nIdx = 0;

			Dt_Info.fCurLoad = 0;
			Dt_Info.fLoadValue = 0;
			Dt_Info.nJiaZaiOrXieZai = LOAD_VALUE;
			Dt_Info.nTimeGap = Pro_Info.nLoadTimeList[0];

			strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
			strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));

			Dt_Info.fWeiyiAvg = 0;
			for (int m = 0; m < nWeiYiCnt; ++m)
			{
				Dt_Info.fWeiyi[m] = fWeiyi;
			}
			Dt_Info.fCurYouya = 0;

			fWeiyi = fGapWeiyi;
			vDataInfo.push_back(Dt_Info);
			continue;
		}
		else if (1 == i)
		{
			vLoad.push_back(nHezai);
			vLoad.push_back(30);
			vLoadOff.push_back(nHezai);
		}
		else if (2 == i)
		{
			vLoad.push_back(nHezai);
			vLoad.push_back(30);
			vLoad.push_back(40);
			vLoadOff.push_back(30);
			vLoadOff.push_back(nHezai);
		}
		else if (3 == i)
		{
			vLoad.push_back(nHezai);
			vLoad.push_back(30);
			vLoad.push_back(40);
			vLoad.push_back(50);
			vLoadOff.push_back(40);
			vLoadOff.push_back(30);
			vLoadOff.push_back(nHezai);
		}
		else if (4 == i)
		{
			vLoad.push_back(nHezai);
			vLoad.push_back(30);
			vLoad.push_back(50);
			vLoad.push_back(60);
			vLoadOff.push_back(50);
			vLoadOff.push_back(30);
			vLoadOff.push_back(nHezai);
		}
		else if (5 == i)
		{
			vLoad.push_back(nHezai);
			vLoad.push_back(30);
			vLoad.push_back(60);
			vLoad.push_back(70);
			vLoadOff.push_back(60);
			vLoadOff.push_back(30);
			vLoadOff.push_back(nHezai);
		}
		else
		{
			vLoad.push_back(nHezai);
			vLoad.push_back(30);
			vLoad.push_back(60);
			vLoad.push_back(80);
			vLoadOff.push_back(60);
			vLoadOff.push_back(30);
			vLoadOff.push_back(nHezai);
		}


		//加载数据
		fGapWeiyi = 0.1f;
		nBenjiId = 1;
		for (int k = 0; k < (int)vLoad.size(); ++k)
		{
			int nLoad = int(Pro_Info.nMaxLoad * vLoad[k] / 100);
			Dt_Info.nIdx = nBenjiId;
			Dt_Info.fCurLoad = (float)nLoad + GetRandVal(RAND_MIN_VAL, RAND_MAX_VAL);
			Dt_Info.fLoadValue = (float)nLoad;
			Dt_Info.fCurYouya = (float)nLoad * 0.1f;
			Dt_Info.nJiaZaiOrXieZai = LOAD_VALUE;
			int nTimes = 3;
			if (k == vLoad.size() - 1)
			{
				nTimes = 4;
			}
			for (int j = 0; j < nTimes; ++j)
			{
				Dt_Info.nRecordId = j;
				Dt_Info.nTimeGap = Pro_Info.nLoadTimeList[j];
				ct += 60 * Dt_Info.nTimeGap;
				strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
				strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));
				if (k != 0)
				{			
					if (j == nTimes - 1)
					{
						fWeiyi += 0.09;
					}
					else
					{
						fWeiyi += fGapWeiyi - fGapWeiyi * j * 0.1f;
					}
				}
				
				Dt_Info.fWeiyiAvg = fWeiyi;
				for (int m = 0; m < nWeiYiCnt; ++m)
				{
					Dt_Info.fWeiyi[m] = fWeiyi;
				}
				vDataInfo.push_back(Dt_Info);
			}
			nBenjiId++;
		}

		nBenjiId = 0;
		//卸载数据
		for (int k = 0; k < (int)vLoadOff.size(); ++k)
		{
			int nLoad = int(Pro_Info.nMaxLoad * vLoadOff[k] / 100);
			Dt_Info.nIdx = nBenjiId;
			Dt_Info.fCurLoad = (float)nLoad + GetRandVal(RAND_MIN_VAL, RAND_MAX_VAL);
			Dt_Info.fLoadValue = (float)nLoad;
			Dt_Info.fCurYouya = (float)nLoad * 0.1f;
			Dt_Info.nJiaZaiOrXieZai = LOADOFF_VALUE;
			//fWeiyi -= fGapWeiyi * 0.2;
			fWeiyi -= fGapWeiyi * 1.5;
			for (int j = 0; j < 3; ++j)
			{
				Dt_Info.nRecordId = j;
				Dt_Info.nTimeGap = Pro_Info.nLoadOffTimeList[j];
				ct += 60 * Dt_Info.nTimeGap;
				strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
				strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));

				Dt_Info.fWeiyiAvg = fWeiyi;
				for (int m = 0; m < nWeiYiCnt; ++m)
				{
					Dt_Info.fWeiyi[m] = fWeiyi;
				}

				vDataInfo.push_back(Dt_Info);
			}
			nBenjiId++;
		}
	}
	Pro_Info.nDataCnt = (int)vDataInfo.size();
}

//锚杆多循环验收试验
void CMGData::CreateNewData8(MG_PROJECT_INFO &Pro_Info, vector<DATA_INFO> &vDataInfo)
{
	DATA_INFO Dt_Info;
	ZeroMemory(&Dt_Info, sizeof(DATA_INFO));
	Dt_Info.chBeiZhu[0] = '\0';
	USES_CONVERSION;
	CString strVal(L"");
	float fVal = 0;
	float fLastVal = 0; //上一级位移

	CTime ct;
	ct = CTime::GetCurrentTime();

	int nBenjiId = 0;
	float fWeiyi = 0;
	float nBegnLoad = 0, nEndLoad = 0;
	//初始拉力
	int nInitLoad = int(Pro_Info.nMaxLoad * Pro_Info.nChuShiHeZai / 100);
	float fGapWeiyi = 0.05f;
	//根据循环加数据
	for (int i = 0; i < Pro_Info.chXunHuanCnt + 1; ++i)
	{
		if (0 == i)
		{
			Dt_Info.nRecordId = 0;
			Dt_Info.nIdx = 0;

			Dt_Info.fCurLoad = 0;
			Dt_Info.fLoadValue = 0;
			Dt_Info.nJiaZaiOrXieZai = LOAD_VALUE;
			Dt_Info.nTimeGap = Pro_Info.nLoadTimeList[0];

			strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
			strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));

			Dt_Info.fWeiyiAvg = 0;
			for (int m = 0; m < nWeiYiCnt; ++m)
			{
				Dt_Info.fWeiyi[m] = fWeiyi;
			}
			Dt_Info.fCurYouya = 0;

			fWeiyi = fGapWeiyi;
			vDataInfo.push_back(Dt_Info);
			continue;
		}
		else if (1 == i && nInitLoad < 50)
		{
			nEndLoad = 50;
		}
		else
		{
			nEndLoad += 10;
			if (nEndLoad > 100)
			{
				break;
			}
		}
		vector<int> vLoad;
		vector<int> vLoadOff;
		int nGap = 20;
		if (Pro_Info.chMaoGanFangShi == 2)//基础锚杆
		{
			nGap = 50;
		}
		int nHezai = Pro_Info.nChuShiHeZai;
		while (nHezai <= nEndLoad){
			vLoad.push_back(nHezai);
			nHezai += nGap;
			if (nHezai >= 50)
			{
				nGap = 10;
			}
		}
		if (vLoad.empty())
		{
			return;
		}
		int nLoadoff = 0;
		if (vLoad[vLoad.size() - 1] > 80)
		{
			nLoadoff = 70;
		}
		else if (vLoad[vLoad.size() - 1] > 60)
		{
			nLoadoff = 50;
		}
		else if (vLoad[vLoad.size() - 1] > 30)
		{
			if (Pro_Info.chMaoGanFangShi == 2)//基础锚杆
			{
				nLoadoff = 0;
			}
			else{
				nLoadoff = 30;
			}		
		}
		else
		{
			nLoadoff = vLoad[vLoad.size() - 1];
		}
		while (nLoadoff >= Pro_Info.nChuShiHeZai)
		{
			vLoadOff.push_back(nLoadoff);		
			if (Pro_Info.chMaoGanFangShi == 2 && nLoadoff <= 50)//基础锚杆
			{
				nLoadoff -= 50;
			}
			else
			{
				nLoadoff -= 20;
			}
		}

		//加载数据
		fGapWeiyi = 0.08f;
		if (Pro_Info.chMaoGanFangShi == 3)
		{
			fGapWeiyi = 0.24f;
		}
		else if (Pro_Info.chGuDingType == 0)
		{
			fGapWeiyi = 0.08f;
		}
		else
		{
			fGapWeiyi = 0.16f;
		}
		nBenjiId = 1;
		for (int k = 0; k < (int)vLoad.size(); ++k)
		{
			int nLoad = int(Pro_Info.nMaxLoad * vLoad[k] / 100);
			Dt_Info.nIdx = nBenjiId;
			Dt_Info.fCurLoad = (float)nLoad + GetRandVal(RAND_MIN_VAL, RAND_MAX_VAL);
			Dt_Info.fLoadValue = (float)nLoad;
			Dt_Info.fCurYouya = Dt_Info.fCurLoad  * 0.1f;
			Dt_Info.nJiaZaiOrXieZai = LOAD_VALUE;
			int nTimes = 2;
			if (k == vLoad.size() - 1)
			{
				nTimes = 4;
			}
			for (int j = 0; j < nTimes; ++j)
			{
				Dt_Info.nRecordId = j;
				Dt_Info.nTimeGap = Pro_Info.nLoadTimeList[j];
				ct += 60 * Dt_Info.nTimeGap;
				strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
				strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));
				if (k != 0)
				{
					fWeiyi += fGapWeiyi - fGapWeiyi * j * 0.25f;
				}
				Dt_Info.fWeiyiAvg = fWeiyi;
				for (int m = 0; m < nWeiYiCnt; ++m)
				{
					Dt_Info.fWeiyi[m] = fWeiyi;
				}
				vDataInfo.push_back(Dt_Info);
			}
			nBenjiId++;
		}

		nBenjiId = 0;
		//卸载数据
		for (int k = 0; k < (int)vLoadOff.size(); ++k)
		{
			int nLoad = int(Pro_Info.nMaxLoad * vLoadOff[k] / 100);
			Dt_Info.nIdx = nBenjiId;
			Dt_Info.fCurLoad = (float)nLoad + GetRandVal(RAND_MIN_VAL, RAND_MAX_VAL);;
			Dt_Info.fLoadValue = (float)nLoad;
			Dt_Info.fCurYouya = Dt_Info.fCurLoad  * 0.1f;
			Dt_Info.nJiaZaiOrXieZai = LOADOFF_VALUE;
			fWeiyi -= fGapWeiyi;
			for (int j = 0; j < 2; ++j)
			{
				Dt_Info.nRecordId = j;
				Dt_Info.nTimeGap = Pro_Info.nLoadOffTimeList[j];
				ct += 60 * Dt_Info.nTimeGap;
				strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
				strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));

				Dt_Info.fWeiyiAvg = fWeiyi;
				for (int m = 0; m < nWeiYiCnt; ++m)
				{
					Dt_Info.fWeiyi[m] = fWeiyi;
				}

				vDataInfo.push_back(Dt_Info);
			}
			nBenjiId++;
		}
	}
	Pro_Info.nDataCnt = (int)vDataInfo.size();
}

void CMGData::CreateNewData7(MG_PROJECT_INFO &Pro_Info, vector<DATA_INFO> &vDataInfo)
{
	DATA_INFO Dt_Info;
	ZeroMemory(&Dt_Info, sizeof(DATA_INFO));
	Dt_Info.chBeiZhu[0] = '\0';
	USES_CONVERSION;
	CString strVal(L"");
	CTime ct;
	ct = CTime::GetCurrentTime();

	int nBenjiId = 0;
	float fWeiyi = 0;
	float nBegnLoad = 0, nEndLoad = 0;
	//初始拉力
	int nInitLoad = int(Pro_Info.nMaxLoad * Pro_Info.nChuShiHeZai / 100);
	//加卸载分级
	vector<int> vLoad;
	vector<int> vLoadOff;
	int nGap = 10;
	int nHezai = Pro_Info.nChuShiHeZai;
	while (nHezai <= 100){
		vLoad.push_back(nHezai);
		nHezai += nGap;
	}
	if (vLoad.empty())
	{
		return;
	}
	int nLoadoff = 0;
	if (vLoad[vLoad.size() - 1] > Pro_Info.nChuShiHeZai)
	{
		nLoadoff = vLoad[vLoad.size() - 1] - 20;
	}
	while (nLoadoff >= Pro_Info.nChuShiHeZai)
	{
		vLoadOff.push_back(nLoadoff);
		nLoadoff -= 20;
	}

	Dt_Info.nRecordId = 0;
	Dt_Info.nIdx = 0;
	float fGapWeiyi = 0.05f;
	//初始
	Dt_Info.fCurLoad = 0;
	Dt_Info.fLoadValue = 0;
	Dt_Info.nJiaZaiOrXieZai = LOAD_VALUE;
	Dt_Info.nTimeGap = Pro_Info.nLoadTimeList[0];
	strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
	strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));
	Dt_Info.fWeiyiAvg = 0;
	for (int m = 0; m < nWeiYiCnt; ++m)
	{
		Dt_Info.fWeiyi[m] = fWeiyi;
	}
	Dt_Info.fCurYouya = 0;
	vDataInfo.push_back(Dt_Info);

	//加载数据
	fGapWeiyi = 0.08f;
	if (Pro_Info.chMaoGanFangShi == 3)
	{
		fGapWeiyi = 0.24f;
	}
	else if (Pro_Info.chGuDingType == 0)
	{
		fGapWeiyi = 0.08f;
	}
	else
	{
		fGapWeiyi = 0.16f;
	}
	nBenjiId = 1;
	float fk = 0.8f;
	float fWy = fGapWeiyi;
	for (int i = 0; i < (int)vLoad.size(); ++i)
	{
		fk = 0.8f + i * 0.1f;
		fWy = fk * fGapWeiyi;
		int nLoad = int(Pro_Info.nMaxLoad * vLoad[i] / 100);
		if (nLoad >= Pro_Info.nMaxLoad)
		{
			nLoad = int(Pro_Info.nMaxLoad);
		}
		Dt_Info.nIdx = nBenjiId;
		Dt_Info.fCurLoad = (float)nLoad + GetRandVal(RAND_MIN_VAL, RAND_MAX_VAL);
		Dt_Info.fLoadValue = (float)nLoad;
		Dt_Info.fCurYouya = Dt_Info.fCurLoad * 0.1f;
		Dt_Info.nJiaZaiOrXieZai = LOAD_VALUE;

		for (int j = 0; j < 7; ++j)
		{
			Dt_Info.nRecordId = j;
			Dt_Info.nTimeGap = Pro_Info.nLoadTimeList[j];
			ct += 60 * Dt_Info.nTimeGap;
			strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
			strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));
			fWeiyi += fWy - fWy * j * 0.2f;
			Dt_Info.fWeiyiAvg = fWeiyi;
			for (int m = 0; m < nWeiYiCnt; ++m)
			{
				Dt_Info.fWeiyi[m] = fWeiyi;
			}
			vDataInfo.push_back(Dt_Info);
		}
		nBenjiId++;
	}

	nBenjiId = 0;
	//卸载数据
	fGapWeiyi = fGapWeiyi;
	for (int i = 0; i < (int)vLoadOff.size(); ++i)
	{
		fk = 1.2f - i * 0.1f;
		fWy = fk * fGapWeiyi;
		int nLoad = int(Pro_Info.nMaxLoad * vLoadOff[i] / 100);
		Dt_Info.nIdx = nBenjiId;
		Dt_Info.fCurLoad = (float)nLoad + GetRandVal(RAND_MIN_VAL, RAND_MAX_VAL);
		Dt_Info.fLoadValue = (float)nLoad;
		Dt_Info.fCurYouya = Dt_Info.fCurLoad  * 0.1f;
		Dt_Info.nJiaZaiOrXieZai = LOADOFF_VALUE;
	
		for (int j = 0; j < 4; ++j)
		{
			Dt_Info.nRecordId = j;
			Dt_Info.nTimeGap = Pro_Info.nLoadOffTimeList[j];
			ct += 60 * Dt_Info.nTimeGap;
			strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
			strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));
			fWeiyi -= fWy - fWy * j * 0.2f;
			Dt_Info.fWeiyiAvg = fWeiyi;
			for (int m = 0; m < nWeiYiCnt; ++m)
			{
				Dt_Info.fWeiyi[m] = fWeiyi;
			}

			vDataInfo.push_back(Dt_Info);
		}
		nBenjiId++;
	}
	Pro_Info.nDataCnt = (int)vDataInfo.size();
}

//锚杆多循环基本试验
void CMGData::CreateNewData6(MG_PROJECT_INFO &Pro_Info, vector<DATA_INFO> &vDataInfo)
{
	DATA_INFO Dt_Info;
	ZeroMemory(&Dt_Info, sizeof(DATA_INFO));
	Dt_Info.chBeiZhu[0] = '\0';
	USES_CONVERSION;
	CString strVal(L"");
	float fVal = 0;
	float fLastVal = 0; //上一级位移

	CTime ct;
	ct = CTime::GetCurrentTime();

	int nBenjiId = 0;
	float fWeiyi = 0;
	float nBegnLoad = 0, nEndLoad = 0;
	//初始拉力
	int nInitLoad = int(Pro_Info.nMaxLoad * Pro_Info.nChuShiHeZai / 100);
	float fGapWeiyi = 0.05f;
	//根据循环加数据
	for (int i = 0; i < Pro_Info.chXunHuanCnt + 1; ++i)
	{
		if (0 == i)
		{
			Dt_Info.nRecordId = 0;
			Dt_Info.nIdx = 0;

			Dt_Info.fCurLoad = 0;
			Dt_Info.fLoadValue = 0;
			Dt_Info.nJiaZaiOrXieZai = LOAD_VALUE;
			Dt_Info.nTimeGap = Pro_Info.nLoadTimeList[0];

			strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
			strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));

			Dt_Info.fWeiyiAvg = 0;
			for (int m = 0; m < nWeiYiCnt; ++m)
			{
				Dt_Info.fWeiyi[m] = fWeiyi;
			}
			Dt_Info.fCurYouya = 0;

			fWeiyi = fGapWeiyi;
			vDataInfo.push_back(Dt_Info);
			continue;
		}
		else if (1 == i && nInitLoad < 50)
		{
			nEndLoad = 50;
		}
		else
		{
			nEndLoad += 10;
			if (nEndLoad > 100)
			{
				break;
			}
		}
		vector<int> vLoad;
		vector<int> vLoadOff;
		int nGap = 20;
		int nHezai = Pro_Info.nChuShiHeZai;
		while (nHezai <= nEndLoad){
			vLoad.push_back(nHezai);
			nHezai += nGap;
			if (nHezai >= 50)
			{
				nGap = 10;
			}
		}
		if (vLoad.empty())
		{
			return;
		}
		int nLoadoff = 0;
		if (vLoad[vLoad.size() - 1] > 70)
		{
			nLoadoff = 70;
		}
		else if(vLoad[vLoad.size() - 1] > 50)
		{
			nLoadoff = 50;
		}
		else if(vLoad[vLoad.size() - 1] > 30)
		{
			nLoadoff = 30;
		}
		else
		{
			nLoadoff = vLoad[vLoad.size() - 1];
		}
		while (nLoadoff >= Pro_Info.nChuShiHeZai)
		{
			vLoadOff.push_back(nLoadoff);
			nLoadoff -= 20;
		}
	
		//加载数据
		fGapWeiyi = 0.08f;
		if (Pro_Info.chMaoGanFangShi == 3)
		{
			fGapWeiyi = 0.24f;
		}
		else if (Pro_Info.chGuDingType == 0)
		{
			fGapWeiyi = 0.08f;
		}
		else
		{
			fGapWeiyi = 0.16f;
		}
		nBenjiId = 1;
		float fk = 0.8f;
		float fWy = fGapWeiyi;
		for (int k = 0; k < (int)vLoad.size(); ++k)
		{
			fk = 0.8f + k * 0.1f;
			fWy = fk * fGapWeiyi;
			int nLoad = int(Pro_Info.nMaxLoad * vLoad[k] / 100);
			Dt_Info.nIdx = nBenjiId;
			Dt_Info.fCurLoad = (float)nLoad + GetRandVal(RAND_MIN_VAL, RAND_MAX_VAL);
			Dt_Info.fLoadValue = (float)nLoad;
			Dt_Info.fCurYouya = (float)nLoad * 0.1f;
			Dt_Info.nJiaZaiOrXieZai = LOAD_VALUE;

			int nTime = 2;
			if (k == vLoad.size() - 1)
			{
				nTime = 3;
			}
			for (int j = 0; j < nTime; ++j)
			{
				Dt_Info.nRecordId = j;
				Dt_Info.nTimeGap = Pro_Info.nLoadTimeList[j];
				ct += 60 * Dt_Info.nTimeGap;
				strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
				strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));
				if (k != 0)
				{
					fWeiyi += fWy - fWy * j * 0.3f;
				}	
				Dt_Info.fWeiyiAvg = fWeiyi;
				for (int m = 0; m < nWeiYiCnt; ++m)
				{
					Dt_Info.fWeiyi[m] = fWeiyi;
				}
				vDataInfo.push_back(Dt_Info);
			}
			nBenjiId++;
		}

		nBenjiId = 0;
		//卸载数据
		//fGapWeiyi = fGapWeiyi / 2;
		for (int k = 0; k < (int)vLoadOff.size(); ++k)
		{
			fk = 1.1f - k * 0.1f;
			fWy = fk * fGapWeiyi;
			int nLoad = int(Pro_Info.nMaxLoad * vLoadOff[k] / 100);
			Dt_Info.nIdx = nBenjiId;
			Dt_Info.fCurLoad = (float)nLoad + GetRandVal(RAND_MIN_VAL, RAND_MAX_VAL); 
			Dt_Info.fLoadValue = (float)nLoad;
			Dt_Info.fCurYouya = (float)nLoad * 0.1f;
			Dt_Info.nJiaZaiOrXieZai = LOADOFF_VALUE;
			fWeiyi -= fWy;

			for (int j = 0; j < 2; ++j)
			{
				Dt_Info.nRecordId = j;
				Dt_Info.nTimeGap = Pro_Info.nLoadOffTimeList[j];
				ct += 60 * Dt_Info.nTimeGap;
				strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
				strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));

				Dt_Info.fWeiyiAvg = fWeiyi;
				for (int m = 0; m < nWeiYiCnt; ++m)
				{
					Dt_Info.fWeiyi[m] = fWeiyi;
				}

				vDataInfo.push_back(Dt_Info);
			}
			nBenjiId++;
		}
	}
	Pro_Info.nDataCnt = (int)vDataInfo.size();
}

//JGJ/T 401-2017 锚杆单循环验收试验
void CMGData::CreateNewData_GF_JGJ_T_401_2017_YS_S(MG_PROJECT_INFO &Pro_Info, vector<DATA_INFO> &vDataInfo)
{
	DATA_INFO Dt_Info;
	ZeroMemory(&Dt_Info, sizeof(DATA_INFO));
	Dt_Info.chBeiZhu[0] = '\0';
	USES_CONVERSION;
	CString strVal(L"");
	CTime ct;
	ct = CTime::GetCurrentTime();

	int nBenjiId = 0;
	float fWeiyi = 0;
	float nBegnLoad = 0, nEndLoad = 0;
	//初始拉力
	int nInitLoad = int(Pro_Info.nMaxLoad * Pro_Info.nChuShiHeZai / 100);
	vector<int> vLoad;
	vector<int> vLoadOff;
	int nGap = 20;
	int nHezai = Pro_Info.nChuShiHeZai;
	while (nHezai <= 100){
		vLoad.push_back(nHezai);
		nHezai += nGap;
		if (nHezai >= 50)
		{
			nGap = 10;
		}
	}
	if (vLoad.empty())
	{
		return;
	}
	int nLoadoff = 0;
	if (vLoad[vLoad.size() - 1] > 70)
	{
		nLoadoff = 70;
	}
	else
	{
		nLoadoff = vLoad[vLoad.size() - 1];
	}
	while (nLoadoff >= Pro_Info.nChuShiHeZai)
	{
		vLoadOff.push_back(nLoadoff);
		nLoadoff -= 20;
	}

	Dt_Info.nRecordId = 0;
	Dt_Info.nIdx = 0;
	float fGapWeiyi = 0.05f;
	//初始
	Dt_Info.fCurLoad = 0;
	Dt_Info.fLoadValue = 0;
	Dt_Info.nJiaZaiOrXieZai = LOAD_VALUE;
	Dt_Info.nTimeGap = Pro_Info.nLoadTimeList[0];
	strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
	strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));
	Dt_Info.fWeiyiAvg = 0;
	for (int m = 0; m < nWeiYiCnt; ++m)
	{
		Dt_Info.fWeiyi[m] = fWeiyi;
	}
	Dt_Info.fCurYouya = 0;
	vDataInfo.push_back(Dt_Info);

	//加载数据
	fGapWeiyi = 0.08f;
	if (Pro_Info.chMaoGanFangShi == 3)
	{
		fGapWeiyi = 0.24f;
	}
	else if (Pro_Info.chGuDingType == 0)
	{
		fGapWeiyi = 0.08f;
	}
	else
	{
		fGapWeiyi = 0.16f;
	}
	nBenjiId = 1;
	float fk = 0.8f;
	float fWy = fGapWeiyi;
	for (int i = 0; i < (int)vLoad.size(); ++i)
	{
		fk = 0.8f + i * 0.1f;
		fWy = fk * fGapWeiyi;
		if (vLoad[i] == 0)
		{
			continue;
		}
		int nLoad = int(Pro_Info.nMaxLoad * vLoad[i] / 100);
		if (nLoad >= Pro_Info.nMaxLoad)
		{
			nLoad = int(Pro_Info.nMaxLoad);
		}
		Dt_Info.nIdx = nBenjiId;
		Dt_Info.fCurLoad = (float)nLoad + GetRandVal(RAND_MIN_VAL, RAND_MAX_VAL);
		Dt_Info.fLoadValue = (float)nLoad;
		Dt_Info.fCurYouya = (float)nLoad  * 0.1f;
		Dt_Info.nJiaZaiOrXieZai = LOAD_VALUE;

		for (int j = 0; j < 3; ++j)
		{
			Dt_Info.nRecordId = j;
			Dt_Info.nTimeGap = Pro_Info.nLoadTimeList[j];
			ct += 60 * Dt_Info.nTimeGap;
			strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
			strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));
			fWeiyi += fWy - fWy * j * 0.3f;
			Dt_Info.fWeiyiAvg = fWeiyi;
			for (int m = 0; m < nWeiYiCnt; ++m)
			{
				Dt_Info.fWeiyi[m] = fWeiyi;
			}
			vDataInfo.push_back(Dt_Info);
		}
		nBenjiId++;
	}

	nBenjiId = 0;
	//卸载数据
	//	fGapWeiyi = fGapWeiyi;
	for (int i = 0; i < (int)vLoadOff.size(); ++i)
	{
		fk = 1.2f - i * 0.1f;
		fWy = fk * fGapWeiyi;
		int nLoad = int(Pro_Info.nMaxLoad * vLoadOff[i] / 100);
		Dt_Info.nIdx = nBenjiId;
		Dt_Info.fCurLoad = (float)nLoad + GetRandVal(RAND_MIN_VAL, RAND_MAX_VAL);
		Dt_Info.fLoadValue = (float)nLoad;
		Dt_Info.fCurYouya = (float)nLoad  * 0.1f;
		Dt_Info.nJiaZaiOrXieZai = LOADOFF_VALUE;

		fWeiyi -= fWy;
		for (int j = 0; j < 2; ++j)
		{
			Dt_Info.nRecordId = j;
			Dt_Info.nTimeGap = Pro_Info.nLoadOffTimeList[j];
			ct += 60 * Dt_Info.nTimeGap;
			strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
			strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));

			Dt_Info.fWeiyiAvg = fWeiyi;
			for (int m = 0; m < nWeiYiCnt; ++m)
			{
				Dt_Info.fWeiyi[m] = fWeiyi;
			}

			vDataInfo.push_back(Dt_Info);
		}
		nBenjiId++;
	}
	Pro_Info.nDataCnt = (int)vDataInfo.size();
}

void CMGData::CreateNewData5(MG_PROJECT_INFO &Pro_Info, vector<DATA_INFO> &vDataInfo)
{
	DATA_INFO Dt_Info;
	ZeroMemory(&Dt_Info, sizeof(DATA_INFO));
	Dt_Info.chBeiZhu[0] = '\0';
	USES_CONVERSION;
	CString strVal(L"");
	CTime ct;
	ct = CTime::GetCurrentTime();

	int nBenjiId = 0;
	float fWeiyi = 0;
	float nBegnLoad = 0, nEndLoad = 0;
	//初始拉力
	int nInitLoad = int(Pro_Info.nMaxLoad * Pro_Info.nChuShiHeZai / 100);
	vector<int> vLoad;
	vector<int> vLoadOff;
	int nGap = 20;
	int nHezai = Pro_Info.nChuShiHeZai;
	while (nHezai <= 100){
		vLoad.push_back(nHezai);
		nHezai += nGap;
		if (nHezai >= 50)
		{
			nGap = 10;
		}
	}
	if (vLoad.empty())
	{
		return;
	}
	int nLoadoff = 0;
	if (vLoad[vLoad.size() - 1] > 70)
	{
		nLoadoff = 70;
	}
	else
	{
		nLoadoff = vLoad[vLoad.size() - 1];
	}
	while (nLoadoff >= Pro_Info.nChuShiHeZai)
	{
		vLoadOff.push_back(nLoadoff);
		nLoadoff -= 20;
	}

	Dt_Info.nRecordId = 0;
	Dt_Info.nIdx = 0;
	float fGapWeiyi = 0.05f;
	//初始
	Dt_Info.fCurLoad = 0;
	Dt_Info.fLoadValue = 0;
	Dt_Info.nJiaZaiOrXieZai = LOAD_VALUE;
	Dt_Info.nTimeGap = Pro_Info.nLoadTimeList[0];
	strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
	strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));
	Dt_Info.fWeiyiAvg = 0;
	for (int m = 0; m < nWeiYiCnt; ++m)
	{
		Dt_Info.fWeiyi[m] = fWeiyi;
	}
	Dt_Info.fCurYouya = 0;
	vDataInfo.push_back(Dt_Info);
	
	//加载数据
	fGapWeiyi = 0.08f;
	if (Pro_Info.chMaoGanFangShi == 3)
	{
		fGapWeiyi = 0.24f;
	}
	else if(Pro_Info.chGuDingType == 0)
	{
		fGapWeiyi = 0.08f;
	}
	else
	{
		fGapWeiyi = 0.16f;
	}
	nBenjiId = 1;
	float fk = 0.8f;
	float fWy = fGapWeiyi;
	for (int i = 0; i < (int)vLoad.size(); ++i)
	{
		fk = 0.8f + i * 0.1f;
		fWy = fk * fGapWeiyi;
		if (vLoad[i] == 0)
		{
			continue;
		}
		int nLoad = int(Pro_Info.nMaxLoad * vLoad[i] / 100);
		if (nLoad >= Pro_Info.nMaxLoad)
		{
			nLoad = int(Pro_Info.nMaxLoad);
		}
		Dt_Info.nIdx = nBenjiId;
		Dt_Info.fCurLoad = (float)nLoad + GetRandVal(RAND_MIN_VAL, RAND_MAX_VAL);
		Dt_Info.fLoadValue = (float)nLoad;
		Dt_Info.fCurYouya = (float)nLoad  * 0.1f;
		Dt_Info.nJiaZaiOrXieZai = LOAD_VALUE;

		for (int j = 0; j < 3; ++j)
		{
			Dt_Info.nRecordId = j;
			Dt_Info.nTimeGap = Pro_Info.nLoadTimeList[j];
			ct += 60 * Dt_Info.nTimeGap;
			strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
			strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));
			fWeiyi += fWy - fWy * j * 0.3f;
			Dt_Info.fWeiyiAvg = fWeiyi;
			for (int m = 0; m < nWeiYiCnt; ++m)
			{
				Dt_Info.fWeiyi[m] = fWeiyi;
			}
			vDataInfo.push_back(Dt_Info);
		}
		nBenjiId++;
	}

	nBenjiId = 0;
	//卸载数据
//	fGapWeiyi = fGapWeiyi;
	for (int i = 0; i < (int)vLoadOff.size(); ++i)
	{
		fk = 1.2f - i * 0.1f;
		fWy = fk * fGapWeiyi;
		int nLoad = int(Pro_Info.nMaxLoad * vLoadOff[i] / 100);
		Dt_Info.nIdx = nBenjiId;
		Dt_Info.fCurLoad = (float)nLoad + GetRandVal(RAND_MIN_VAL, RAND_MAX_VAL);
		Dt_Info.fLoadValue = (float)nLoad;
		Dt_Info.fCurYouya = (float)nLoad  * 0.1f;
		Dt_Info.nJiaZaiOrXieZai = LOADOFF_VALUE;

		fWeiyi -= fWy;
		for (int j = 0; j < 2; ++j)
		{
			Dt_Info.nRecordId = j;
			Dt_Info.nTimeGap = Pro_Info.nLoadOffTimeList[j];
			ct += 60 * Dt_Info.nTimeGap;
			strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
			strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));
	
			Dt_Info.fWeiyiAvg = fWeiyi;
			for (int m = 0; m < nWeiYiCnt; ++m)
			{
				Dt_Info.fWeiyi[m] = fWeiyi;
			}

			vDataInfo.push_back(Dt_Info);
		}
		nBenjiId++;
	}
	Pro_Info.nDataCnt = (int)vDataInfo.size();
}

//锚杆验收数据
void CMGData::CreateNewData4(MG_PROJECT_INFO &Pro_Info, vector<DATA_INFO> &vDataInfo)
{
	DATA_INFO Dt_Info;
	ZeroMemory(&Dt_Info, sizeof(DATA_INFO));
	Dt_Info.chBeiZhu[0] = '\0';
	USES_CONVERSION;
	CString strVal(L"");
	float fVal = 0;
	float fLastVal = 0; //上一级位移

	CTime ct;
	ct = CTime::GetCurrentTime();

	int nBenjiId = 0;
	float fWeiyi = 0;
	float nBegnLoad = 0, nEndLoad = 0;

	float fGapWeiyi = 0.02f;
	float fMaxLoadVal = Pro_Info.nMaxLoad;
	int nXunHuanCnt = 7; //20 40 60 70 80 90 100 
	//永久锚杆12级  临时锚杆9级
	if (Pro_Info.chMaoGanType == 0)
	{
		fMaxLoadVal *= 1.5;
	}
	else
	{
		fMaxLoadVal *= 1.2;
	}
	//初始拉力
	float nInitLoad = int(fMaxLoadVal* Pro_Info.nChuShiHeZai / 100);
	float nGapLoad = fMaxLoadVal / 10; //间隔拉力
	//根据循环加数据
	for (int i = 0; i < 2; ++i)
	{
		if (0 == i)
		{
			Dt_Info.nRecordId = 0;
			Dt_Info.nIdx = 0;

			Dt_Info.fCurLoad = 0;
			Dt_Info.fLoadValue = 0;
			Dt_Info.nJiaZaiOrXieZai = LOAD_VALUE;
			Dt_Info.nTimeGap = Pro_Info.nLoadTimeList[0];

			strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
			strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));

			Dt_Info.fWeiyiAvg = 0;
			for (int m = 0; m < nWeiYiCnt; ++m)
			{
				Dt_Info.fWeiyi[m] = fWeiyi;
			}
			Dt_Info.fCurYouya = 0;

			vDataInfo.push_back(Dt_Info);
			continue;
		}
		nBenjiId = 1;
		//加载数据
		float nLoad = nInitLoad;
		for (float nL = 0; nL < nXunHuanCnt; nL++)
		{
			if (nL == 0)
			{
				nLoad = nInitLoad + GetRandVal(RAND_MIN_VAL, RAND_MAX_VAL);
			}
			else if(nL < 3)
			{
				nLoad += (nGapLoad * 2) + GetRandVal(RAND_MIN_VAL, RAND_MAX_VAL);
			}
			else
			{
				nLoad += (nGapLoad)+GetRandVal(RAND_MIN_VAL, RAND_MAX_VAL);
			}
			Dt_Info.nIdx = nBenjiId;
			Dt_Info.fCurLoad = (float)nLoad + GetRandVal(RAND_MIN_VAL, RAND_MAX_VAL);
			Dt_Info.fLoadValue = (float)nLoad;
			Dt_Info.fCurYouya = (float)nLoad * 0.1f;
			Dt_Info.nJiaZaiOrXieZai = LOAD_VALUE;
			int nCnt = 3;
			if (nL == nXunHuanCnt - 1)
			{
				nCnt = 4;
			}
			for (int j = 0; j < nCnt; ++j)
			{
				Dt_Info.nRecordId = j;
				Dt_Info.nTimeGap = Pro_Info.nLoadTimeList[j];
				ct += 60 * Dt_Info.nTimeGap;
				strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
				strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));

				fWeiyi += fGapWeiyi;
				Dt_Info.fWeiyiAvg = fWeiyi;
				for (int m = 0; m < nWeiYiCnt; ++m)
				{
					Dt_Info.fWeiyi[m] = fWeiyi;
				}
				vDataInfo.push_back(Dt_Info);
			}
			nBenjiId++;
		}

		nBenjiId = 0;
		//卸载数据
//		fGapWeiyi = 0.02f;
		Dt_Info.nIdx = nBenjiId;
		Dt_Info.fCurLoad = nGapLoad + GetRandVal(RAND_MIN_VAL, RAND_MAX_VAL);
		Dt_Info.fLoadValue = nGapLoad;
		Dt_Info.fCurYouya = nGapLoad * 0.1f;
		Dt_Info.nJiaZaiOrXieZai = LOADOFF_VALUE;
		fWeiyi /= 2;
		for (int j = 0; j < 3; ++j)
		{
			Dt_Info.nRecordId = j;
			Dt_Info.nTimeGap = Pro_Info.nLoadOffTimeList[j];
			ct += 60 * Dt_Info.nTimeGap;
			strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
			strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));

			fWeiyi -= fGapWeiyi / 2;
			Dt_Info.fWeiyiAvg = fWeiyi;
			for (int m = 0; m < nWeiYiCnt; ++m)
			{
				Dt_Info.fWeiyi[m] = fWeiyi;
			}

			vDataInfo.push_back(Dt_Info);
		}
	}
	Pro_Info.nDataCnt = (int)vDataInfo.size();
}
//锚杆基本
void CMGData::CreateNewData3(MG_PROJECT_INFO &Pro_Info, vector<DATA_INFO> &vDataInfo)
{
	DATA_INFO Dt_Info;
	ZeroMemory(&Dt_Info, sizeof(DATA_INFO));
	Dt_Info.chBeiZhu[0] = '\0';
	USES_CONVERSION;
	CString strVal(L"");
	float fVal = 0;
	float fLastVal = 0; //上一级位移

	CTime ct;
	ct = CTime::GetCurrentTime();

	int nBenjiId = 0;
	float fWeiyi = 0;
	float nBegnLoad = 0, nEndLoad = 0;
	//初始拉力
	float nInitLoad = Pro_Info.nMaxLoad * Pro_Info.nChuShiHeZai / 100;
	float nGapLoad = Pro_Info.nMaxLoad / 5; //间隔拉力
	float fGapWeiyi = 0.02f;
	//根据循环加数据
	for (int i = 0; i < Pro_Info.chXunHuanCnt + 1; ++i)
	{
		if (0 == i)
		{
			Dt_Info.nRecordId = 0;
			Dt_Info.nIdx = 0;

			Dt_Info.fCurLoad = 0;
			Dt_Info.fLoadValue = 0;
			Dt_Info.nJiaZaiOrXieZai = LOAD_VALUE;
			Dt_Info.nTimeGap = Pro_Info.nLoadTimeList[0];

			strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
			strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));

			Dt_Info.fWeiyiAvg = 0;
			for (int m = 0; m < nWeiYiCnt; ++m)
			{
				Dt_Info.fWeiyi[m] = fWeiyi;
			}
			Dt_Info.fCurYouya = 0;

			vDataInfo.push_back(Dt_Info);
			continue;
		}
		else if (1 == i)
		{
			nBegnLoad = nInitLoad;
			nEndLoad = nBegnLoad + nGapLoad * 2;
		}
		else if (2 == i)
		{
			nBegnLoad = nInitLoad;
			nEndLoad = nBegnLoad + nGapLoad * 3;
		}
		else if (3 == i)
		{
			nBegnLoad = nInitLoad;
			nEndLoad = nBegnLoad + nGapLoad * 4;
		}
		else
		{
			nBegnLoad = nInitLoad;
			nEndLoad = nBegnLoad + nGapLoad * 5;
		}

		nBenjiId = 1;
		//加载数据
		fGapWeiyi = 0.03f;
		for (float nL = nBegnLoad; nL <= nEndLoad; nL += nGapLoad)
		{
			int nLoad = int(nL);
			if (nLoad >= Pro_Info.nMaxLoad)
			{
				nLoad = int(Pro_Info.nMaxLoad);
			}		
			Dt_Info.nIdx = nBenjiId;
			Dt_Info.fCurLoad = (float)nLoad + GetRandVal(RAND_MIN_VAL, RAND_MAX_VAL);
			Dt_Info.fLoadValue = (float)nLoad;
			Dt_Info.fCurYouya = (float)nLoad  * 0.1f;
			Dt_Info.nJiaZaiOrXieZai = LOAD_VALUE;

			for (int j = 0; j < 3; ++j)
			{
				Dt_Info.nRecordId = j;
				Dt_Info.nTimeGap = Pro_Info.nLoadTimeList[j];
				ct += 60 * Dt_Info.nTimeGap;
				strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
				strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));

				fWeiyi += fGapWeiyi;
				Dt_Info.fWeiyiAvg = fWeiyi;
				for (int m = 0; m < nWeiYiCnt; ++m)
				{
					Dt_Info.fWeiyi[m] = fWeiyi;
				}
				vDataInfo.push_back(Dt_Info);
			}
			nBenjiId++;
		}

		nBenjiId = 0;
		//卸载数据
		fGapWeiyi = 0.02f;
		for (float nL = nEndLoad - nGapLoad; nL >= nInitLoad; nL -= nGapLoad)
		{
			Dt_Info.nIdx = nBenjiId;
			Dt_Info.fCurLoad = nL + GetRandVal(RAND_MIN_VAL, RAND_MAX_VAL);
			Dt_Info.fLoadValue = nL;
			Dt_Info.fCurYouya = nL * 0.1f;
			Dt_Info.nJiaZaiOrXieZai = LOADOFF_VALUE;

			for (int j = 0; j < 2; ++j)
			{
				Dt_Info.nRecordId = j;
				Dt_Info.nTimeGap = Pro_Info.nLoadOffTimeList[j];
				ct += 60 * Dt_Info.nTimeGap;
				strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
				strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));

				fWeiyi -= fGapWeiyi / 2;
				Dt_Info.fWeiyiAvg = fWeiyi;
				for (int m = 0; m < nWeiYiCnt; ++m)
				{
					Dt_Info.fWeiyi[m] = fWeiyi;
				}

				vDataInfo.push_back(Dt_Info);
			}
			nBenjiId++;
		}
	}
	Pro_Info.nDataCnt = (int)vDataInfo.size();
}
//锚杆验收数据
void CMGData::CreateNewData2(MG_PROJECT_INFO &Pro_Info, vector<DATA_INFO> &vDataInfo)
{
	DATA_INFO Dt_Info;
	ZeroMemory(&Dt_Info, sizeof(DATA_INFO));
	Dt_Info.chBeiZhu[0] = '\0';
	USES_CONVERSION;
	CString strVal(L"");
	float fVal = 0;
	float fLastVal = 0; //上一级位移

	CTime ct;
	ct = CTime::GetCurrentTime();

	int nBenjiId = 0;
	float fWeiyi = 0;
	float nBegnLoad = 0, nEndLoad = 0;
	//初始拉力
	float nInitLoad = Pro_Info.nMaxLoad * Pro_Info.nChuShiHeZai / 100;
	float nMaxLoad = Pro_Info.nMaxLoad;

	float fGapWeiyi = 0.2f;

	//0级
	//根据循环加数据
	Dt_Info.nRecordId = 0;
	Dt_Info.nIdx = 0;

	Dt_Info.fCurLoad = 0;
	Dt_Info.fLoadValue = 0;
	Dt_Info.nJiaZaiOrXieZai = LOAD_VALUE;
	Dt_Info.nTimeGap = Pro_Info.nLoadTimeList[0];
	strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
	strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));
	Dt_Info.fWeiyiAvg = 0;
	for (int m = 0; m < nWeiYiCnt; ++m)
	{
		Dt_Info.fWeiyi[m] = fWeiyi;
	}
	Dt_Info.fCurYouya = 0;
	vDataInfo.push_back(Dt_Info);

	//初始拉力
	nBenjiId++;
	int nXunHuan = 4;
	Dt_Info.nIdx = nBenjiId;
	Dt_Info.fCurLoad = nInitLoad;
	Dt_Info.fLoadValue = Dt_Info.fCurLoad;
	Dt_Info.fCurYouya = Dt_Info.fCurLoad * 0.1f;
	Dt_Info.nJiaZaiOrXieZai = LOAD_VALUE;

//	fWeiyi += fGapWeiyi;
	float fk =0.8f;
	float fWy = 0;
	for (int j = 0; j < nXunHuan; ++j)
	{
		fWy = fk * fGapWeiyi;

		Dt_Info.nRecordId = j;
		Dt_Info.nTimeGap = Pro_Info.nLoadTimeList[j];
		ct += 60 * Dt_Info.nTimeGap;
		strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
		strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));
	
		fWeiyi += fWy - fWy * j * 0.3f;
		Dt_Info.fWeiyiAvg = fWeiyi;
		for (int m = 0; m < nWeiYiCnt; ++m)
		{
			Dt_Info.fWeiyi[m] = fWeiyi;
		}
		vDataInfo.push_back(Dt_Info);
	}

	
	for (int i = 0; i < 5; ++i)
	{
		fk = 0.8f + i*i * 0.1f;
		fWy = fk * fGapWeiyi;

		nBenjiId++;
		Dt_Info.nIdx = nBenjiId;
		Dt_Info.fLoadValue = (0.4f + i*0.2f) * nMaxLoad;
		Dt_Info.fCurLoad = Dt_Info.fLoadValue + GetRandVal(RAND_MIN_VAL, RAND_MAX_VAL);
		Dt_Info.fCurYouya = Dt_Info.fLoadValue * 0.1f;
		Dt_Info.nJiaZaiOrXieZai = LOAD_VALUE;

		for (int j = 0; j < nXunHuan; ++j)
		{		
			fWeiyi += fWy - fWy * j * 0.3f;

			Dt_Info.nRecordId = j;
			Dt_Info.nTimeGap = Pro_Info.nLoadTimeList[j];
			ct += 60 * Dt_Info.nTimeGap;
			strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
			strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));
		
			Dt_Info.fWeiyiAvg = fWeiyi;
			for (int m = 0; m < nWeiYiCnt; ++m)
			{
				Dt_Info.fWeiyi[m] = fWeiyi;
			}
			vDataInfo.push_back(Dt_Info);
		}
	}
	if (Pro_Info.chSafetyLevel == 0)
	{
		nBenjiId++;
		Dt_Info.nIdx = nBenjiId;
		Dt_Info.fLoadValue = 1.4f * nMaxLoad;
		Dt_Info.fCurLoad = Dt_Info.fLoadValue + GetRandVal(RAND_MIN_VAL, RAND_MAX_VAL);
		Dt_Info.fCurYouya = Dt_Info.fLoadValue * 0.1f;
		Dt_Info.nJiaZaiOrXieZai = LOAD_VALUE;

//		fWeiyi += fGapWeiyi;
		fk = 0.8f + 5 * 0.1f;
		for (int j = 0; j < nXunHuan + 1; ++j)
		{		
			fWeiyi += fWy - fWy * j * 0.3f;

			Dt_Info.nRecordId = j;
			Dt_Info.nTimeGap = Pro_Info.nLoadTimeList[j];
			ct += 60 * Dt_Info.nTimeGap;
			strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
			strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));

			Dt_Info.fWeiyiAvg = fWeiyi;
			for (int m = 0; m < nWeiYiCnt; ++m)
			{
				Dt_Info.fWeiyi[m] = fWeiyi;
			}
			vDataInfo.push_back(Dt_Info);
		}
	}
	else if (Pro_Info.chSafetyLevel == 1)
	{
		nBenjiId++;
		Dt_Info.nIdx = nBenjiId;
		Dt_Info.fLoadValue = 1.3f * nMaxLoad;
		Dt_Info.fCurLoad = Dt_Info.fLoadValue + GetRandVal(RAND_MIN_VAL, RAND_MAX_VAL);
		Dt_Info.fCurYouya = Dt_Info.fLoadValue * 0.1f;
		Dt_Info.nJiaZaiOrXieZai = LOAD_VALUE;

//		fWeiyi += fGapWeiyi;
		fk = 0.8f + 5 * 0.1f;
		for (int j = 0; j < nXunHuan + 1; ++j)
		{		
			fWeiyi += fWy - fWy * j * 0.3f;
			Dt_Info.nRecordId = j;
			Dt_Info.nTimeGap = Pro_Info.nLoadTimeList[j];
			ct += 60 * Dt_Info.nTimeGap;
			strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
			strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));

			Dt_Info.fWeiyiAvg = fWeiyi;
			for (int m = 0; m < nWeiYiCnt; ++m)
			{
				Dt_Info.fWeiyi[m] = fWeiyi;
			}
			vDataInfo.push_back(Dt_Info);
		}
	}
	else if (Pro_Info.chSafetyLevel == 2)
	{

	}

	nBenjiId=0;
	//卸载
	if (Pro_Info.chSafetyLevel == 0 || Pro_Info.chSafetyLevel == 1)
	{
		Dt_Info.nIdx = nBenjiId;
		Dt_Info.fLoadValue = 1.2f * nMaxLoad;
		Dt_Info.fCurLoad = Dt_Info.fLoadValue + GetRandVal(RAND_MIN_VAL, RAND_MAX_VAL);
		Dt_Info.fCurYouya = Dt_Info.fLoadValue * 0.1f;
		Dt_Info.nJiaZaiOrXieZai = LOADOFF_VALUE;

		fWy = 1* fGapWeiyi;
		for (int j = 0; j < nXunHuan; ++j)
		{		
			fWeiyi -= (fWy - fWy * j * 0.3f);

			Dt_Info.nRecordId = j;
			Dt_Info.nTimeGap = Pro_Info.nLoadOffTimeList[j];
			ct += 60 * Dt_Info.nTimeGap;
			strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
			strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));

			Dt_Info.fWeiyiAvg = fWeiyi;
			for (int m = 0; m < nWeiYiCnt; ++m)
			{
				Dt_Info.fWeiyi[m] = fWeiyi;
			}

			vDataInfo.push_back(Dt_Info);
		}
		nBenjiId++;
	}
	else if (Pro_Info.chSafetyLevel == 2)
	{

	}

	for (int i = 0; i < 4; ++i)
	{		
		fk = 1 - i * 0.1f;
		fWy = fk * fGapWeiyi;

		Dt_Info.nIdx = nBenjiId;
		Dt_Info.fLoadValue = (1.0f - i*0.2f) * nMaxLoad;
		Dt_Info.fCurLoad = Dt_Info.fLoadValue + GetRandVal(RAND_MIN_VAL, RAND_MAX_VAL);
		Dt_Info.fCurYouya = Dt_Info.fLoadValue * 0.1f;
		Dt_Info.nJiaZaiOrXieZai = LOADOFF_VALUE;

		for (int j = 0; j < nXunHuan; ++j)
		{
			fWeiyi -= (fWy - fWy * j * 0.3f);

			Dt_Info.nRecordId = j;
			Dt_Info.nTimeGap = Pro_Info.nLoadTimeList[j];
			ct += 60 * Dt_Info.nTimeGap;
			strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
			strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));

			Dt_Info.fWeiyiAvg = fWeiyi;
			for (int m = 0; m < nWeiYiCnt; ++m)
			{
				Dt_Info.fWeiyi[m] = fWeiyi;
			}

			vDataInfo.push_back(Dt_Info);
		}
		nBenjiId++;
	}

	Dt_Info.nIdx = nBenjiId;
	Dt_Info.fLoadValue = nInitLoad;
	Dt_Info.fCurLoad = Dt_Info.fLoadValue + GetRandVal(RAND_MIN_VAL, RAND_MAX_VAL);
	Dt_Info.fCurYouya = Dt_Info.fLoadValue * 0.1f;
	Dt_Info.nJiaZaiOrXieZai = LOADOFF_VALUE;

	fWy = 0.5f * fGapWeiyi;
	for (int j = 0; j < nXunHuan; ++j)
	{		
		fWeiyi -= (fWy - fWy * j * 0.3f);

		Dt_Info.nRecordId = j;
		Dt_Info.nTimeGap = Pro_Info.nLoadTimeList[j];
		ct += 60 * Dt_Info.nTimeGap;
		strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
		strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));

		Dt_Info.fWeiyiAvg = fWeiyi;
		for (int m = 0; m < nWeiYiCnt; ++m)
		{
			Dt_Info.fWeiyi[m] = fWeiyi;
		}
		vDataInfo.push_back(Dt_Info);
	}

	Pro_Info.nDataCnt = (int)vDataInfo.size();
}

void CMGData::CreateNewData1(MG_PROJECT_INFO &Pro_Info, vector<DATA_INFO> &vDataInfo)
{
	DATA_INFO Dt_Info;
	ZeroMemory(&Dt_Info, sizeof(DATA_INFO));
	Dt_Info.chBeiZhu[0] = '\0';
	USES_CONVERSION;
	CString strVal(L"");
	float fVal = 0;
	float fLastVal = 0; //上一级位移
	
	CTime ct;
	ct = CTime::GetCurrentTime();

	int nBenjiId = 0;
	float fWeiyi = 0;
	float nBegnLoad = 0, nEndLoad = 0;
	//初始拉力
	float nInitLoad = Pro_Info.nMaxLoad * Pro_Info.nChuShiHeZai / 100;
	float nGapLoad = Pro_Info.nMaxLoad / 10; //间隔拉力
	float fGapWeiyi = 0.02f;
	fGapWeiyi = 0.08f;
	if (Pro_Info.chMaoGanFangShi == 3)
	{
		fGapWeiyi = 0.24f;
	}
	else if (Pro_Info.chGuDingType == 0)
	{
		fGapWeiyi = 0.1f;
	}
	else
	{
		fGapWeiyi = 0.16f;
	}
	//根据循环加数据
	for (int i = 0; i < Pro_Info.chXunHuanCnt + 1; ++i)
	{
		float nLoadVal = 0;
		if (0 == i)
		{
			Dt_Info.nRecordId = 0;
			Dt_Info.nIdx = 0;

			Dt_Info.fCurLoad = 0;
			Dt_Info.fLoadValue = 0;
			Dt_Info.nJiaZaiOrXieZai = LOAD_VALUE;
			Dt_Info.nTimeGap = Pro_Info.nLoadTimeList[0];

			strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
			strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));

			Dt_Info.fWeiyiAvg = 0;
			for (int m = 0; m < nWeiYiCnt; ++m)
			{
				Dt_Info.fWeiyi[m] = fWeiyi;
			}
			Dt_Info.fCurYouya = 0;

			vDataInfo.push_back(Dt_Info);
			continue;
		}

		//本机ID
		nBenjiId = 1;
		//加载数据
		for (int nL = 0; nL < 4; ++nL)
		{
			if (nL == 0)
			{
				nLoadVal = nInitLoad;
			}
			else if (nL == 1)
			{
				nLoadVal += nGapLoad * i;
			}
			else if (nL == 2)
			{
				nLoadVal += nGapLoad * 2;
			}
			else{
				nLoadVal += nGapLoad;
			}
			Dt_Info.nIdx = nBenjiId;
			Dt_Info.fCurLoad = nLoadVal;
			Dt_Info.fLoadValue = nLoadVal;
			Dt_Info.fCurYouya = nLoadVal * 0.1f;
			Dt_Info.nJiaZaiOrXieZai = LOAD_VALUE;
			int nXCnt = 3;
			if (nL == 3)
			{
				nXCnt = 4;
			}
			for (int j = 0; j < nXCnt; ++j)
			{
				Dt_Info.nRecordId = j;
				Dt_Info.nTimeGap = Pro_Info.nLoadTimeList[j];
				ct += 60 * Dt_Info.nTimeGap;
				strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
				strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));

				fWeiyi += fGapWeiyi - j * fGapWeiyi * 0.3f;
				Dt_Info.fWeiyiAvg = fWeiyi;
				for (int m = 0; m < nWeiYiCnt; ++m)
				{
					Dt_Info.fWeiyi[m] = fWeiyi;
				}
				vDataInfo.push_back(Dt_Info);
			}
			nBenjiId++;
		}

		nBenjiId = 0;
		int nLoadGap = 1;
		if (i >= 3)
		{
			nLoadGap = 2;
		}
		//卸载数据
//		fGapWeiyi = 0.02f;
		for (int nL = 0; nL < 3; nL++)
		{
			if (nL == 0)
			{
				nLoadVal -= nGapLoad;
			}
			else if (nL == 1)
			{
				nLoadVal -= nGapLoad * 2;
			}
			else
			{
				nLoadVal = nInitLoad;
			}
			Dt_Info.nIdx = nBenjiId;
			Dt_Info.fCurLoad = nLoadVal;
			Dt_Info.fLoadValue = nLoadVal;
			Dt_Info.fCurYouya = nLoadVal * 0.1f;
			Dt_Info.nJiaZaiOrXieZai = LOADOFF_VALUE;

			for (int j = 0; j < 3; ++j)
			{
				Dt_Info.nRecordId = j;
				Dt_Info.nTimeGap = Pro_Info.nLoadOffTimeList[j];
				ct += 60 * Dt_Info.nTimeGap;
				strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
				strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));

				fWeiyi -= fGapWeiyi / 2;
				Dt_Info.fWeiyiAvg = fWeiyi;
				for (int m = 0; m < nWeiYiCnt; ++m)
				{
					Dt_Info.fWeiyi[m] = fWeiyi;
				}

				vDataInfo.push_back(Dt_Info);
			}
			nBenjiId++;
		}
	}
	Pro_Info.nDataCnt = (int)vDataInfo.size();
}

void CMGData::CreateNewData0(MG_PROJECT_INFO &Pro_Info, vector<DATA_INFO> &vDataInfo)
{
	DATA_INFO Dt_Info;
	ZeroMemory(&Dt_Info, sizeof(DATA_INFO));
	Dt_Info.chBeiZhu[0] = '\0';
	USES_CONVERSION;
	CString strVal(L"");
	float fVal = 0;
	float fLastVal = 0; //上一级位移

	CTime ct;
	ct = CTime::GetCurrentTime();

	float fWeiyi = 0;
	//初始拉力
	float nInitLoad = Pro_Info.nMaxLoad * Pro_Info.nChuShiHeZai / 100;
	float nGapLoad = 2; //间隔拉力
	if (Pro_Info.chXunHuanCnt > 0)
	{
		nGapLoad = (Pro_Info.nMaxLoad - nInitLoad) / (Pro_Info.chXunHuanCnt + 1);
	}
	float fGapWeiyi = 0.2f;
	strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
	strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));

	//根据循环加数据
	for (int i = 0; i < Pro_Info.chXunHuanCnt + 1; ++i)
	{
		Dt_Info.fWeiyiAvg = fWeiyi + fGapWeiyi* i;
		Dt_Info.fCurLoad = nInitLoad + nGapLoad * i;
		ct += 60;
		strVal = ct.Format(L"%Y-%m-%d %H:%M:%S");
		strcpy_s(Dt_Info.chRecordTime, sizeof(Pro_Info.chTestDate), W2A(strVal));

		vDataInfo.push_back(Dt_Info);
	}
	Pro_Info.nDataCnt = (int)vDataInfo.size();
}

//打开文件
CString CMGData::OpenFile(CString strPath, CString strExt, BOOL bCloudData)
{
	if (strExt == EXT_MG) //App端第一版本分享数据 后缀mg
	{
		return m_readFile.OpenMgFile(strPath, bCloudData);
	}
	else if (strExt == EXT_MGS)
	{
		return m_readFile.OpenMgsFile(strPath, bCloudData);	
	}
	return L"";
}


void CMGData::ClearProject()
{
	ZeroMemory(&m_MGProInfo, sizeof(MG_PROJECT_INFO));
	m_vDataInfo.clear();
	m_vDataInfo_Old.clear();
	ZeroMemory(&m_MGProInfo_Old, sizeof(MG_PROJECT_INFO));
}

//打开mgy mgys文件
BOOL CMGData::OpenFile(CString strFilePath)
{
	if (strFilePath == L"")
	{
		return FALSE;
	}
	MG_PROJECT_INFO Pro_Info;
	vector<DATA_INFO> vDataInfo;
	MG_PROJECT_INFO Pro_Info_old;
	vector<DATA_INFO> vDataInfo_old;
	if (m_readFile.OpenFile(strFilePath, Pro_Info, vDataInfo, Pro_Info_old, vDataInfo_old))
	{
		ClearProject();
		m_MGProInfo = Pro_Info;
		m_MGProInfo_Old = Pro_Info_old;
		m_vDataInfo = vDataInfo;
		m_vDataInfo_Old = vDataInfo_old;
		SetCurveUnit(m_MGProInfo);
		InitCalcData();
		return TRUE;
	}
	return FALSE;
}


vector<TABLE_SUMMARY> CMGData::GetMgSummaryData()
{
	return m_vMgSummaryData;
}

//初始统计所有值
void CMGData::InitCalcData()
{
	m_vMgSummaryData.clear();

	if (g_DataType == DATA_0)
	{
		return;
	}
	else if (g_DataType == DATA_1 || g_DataType == DATA_2)
	{
		CalcMgSummaryDataNew(m_vMgSummaryData);
	}
}

void CMGData::CalcMgSummaryDataNew(vector<TABLE_SUMMARY> &vMgSummaryData)
{
	vMgSummaryData.clear();

	TABLE_SUMMARY SumData;
	ZeroMemory(&SumData, sizeof(SumData));
	vector<TABLE_SUMMARY> vSumData;
	int nId = 0;		//本级所以
	int nLoad = 0;		//加载方式
	int nCnt = 0;		//数据个数

	int nLastGap = 0;		//上次时间间隔
	float nLastWaiyi = 0;	//上次位移
	int nXunHuan = 0;
	for (int i = 0; i < (int)m_vDataInfo.size(); ++i)
	{
		if (0 == i)
		{
			nId = 0;
			nLoad = SumData.nJiaZaiOrXieZai;
			SumData.nBenJiId = nXunHuan;
		}
		else if (nId == m_vDataInfo[i].nIdx && nLoad == m_vDataInfo[i].nJiaZaiOrXieZai)
		{

		}
		else
		{
			//当本级ID 和 原始所以 不一样时 就插入容器
			nCnt = 0;
			SumData.fDispVal = SumData.fAllDisp - nLastWaiyi;
			nLastWaiyi = SumData.fAllDisp;

			SumData.nALlTime = nLastGap + SumData.nTimeGap;
			nLastGap = SumData.nALlTime;

			SumData.nLatuodian = m_vDataInfo[i - 1].chLatuodian;
			vMgSummaryData.push_back(SumData);
			ZeroMemory(&SumData, sizeof(SumData));

// 			if (1 == i)
// 			{
// 				nXunHuan++;
// 			}
// 			else if (nXunHuan == 1 && (nId != m_vDataInfo[i].nIdx || nLoad != m_vDataInfo[i].nJiaZaiOrXieZai))
// 			{
// 				nXunHuan++;
// 			}
// 			else if (nLoad == LOADOFF_VALUE && m_vDataInfo[i].nJiaZaiOrXieZai == LOAD_VALUE)
// 			{
// 				nXunHuan++;
// 			}
			if (nXunHuan == 0 && (nId != m_vDataInfo[i].nIdx || nLoad != m_vDataInfo[i].nJiaZaiOrXieZai))
			{
				nXunHuan++;
			}
			else if (nLoad == LOADOFF_VALUE && m_vDataInfo[i].nJiaZaiOrXieZai == LOAD_VALUE)
			{
				nXunHuan++;
			}
			nId = m_vDataInfo[i].nIdx;
			nLoad = m_vDataInfo[i].nJiaZaiOrXieZai;
		}

		int nTimeId = nCnt > 5 ? 5 : nCnt;
		if (m_vDataInfo[i].nJiaZaiOrXieZai == LOAD_VALUE)
		{
			SumData.nTimeGap += m_MGProInfo.nLoadTimeList[nTimeId];
		}
		else
		{
			SumData.nTimeGap += m_MGProInfo.nLoadOffTimeList[nTimeId];
		}
		nCnt++;
		SumData.nDataCnt = nCnt;

		SumData.nBenJiId = nXunHuan;
		SumData.fLoadVal = m_vDataInfo[i].fLoadValue;
		SumData.nJiaZaiOrXieZai = m_vDataInfo[i].nJiaZaiOrXieZai;
		SumData.fAllDisp = m_vDataInfo[i].fWeiyiAvg;

		if (i == (int)m_vDataInfo.size() - 1)
		{
			//当本级ID 和 原始所以 不一样时 就插入容器
			SumData.fDispVal = SumData.fAllDisp - nLastWaiyi;
			SumData.nALlTime = nLastGap + SumData.nTimeGap;

			SumData.nLatuodian = m_vDataInfo[i - 1].chLatuodian;
			vMgSummaryData.push_back(SumData);
		}
	}
}

BOOL CMGData::SaveFile(CString strFilePath)
{
	return m_readFile.SaveFile(strFilePath, m_MGProInfo, m_vDataInfo, m_MGProInfo_Old, m_vDataInfo_Old, int(g_DataType));
}

//根据规范获取数据类型
DATA_TYPE CMGData::GetDataType(int nGuifan)
{
	return (DATA_TYPE)m_standard.GetDataType(nGuifan);
}

void CMGData::SetCurveUnit(MG_PROJECT_INFO &ProInfo)
{
	ProInfo.chUnit = 0;
	m_standard.GetStandardInfo(ProInfo.chStandard);
}

//原始记录修改加载级
void CMGData::ModifyYuanShiVal(int nNo, int nCol, float fVal, CString strTime)
{
	if (nNo < 0 || nNo > (int)m_vDataInfo.size())
	{
		return;
	}
	if (nCol == 1)
	{
		m_vDataInfo[nNo].fCurLoad = fVal;
	}
	else if (nCol == 2)
	{
		m_vDataInfo[nNo].fWeiyiAvg = fVal;
	}
	else if (nCol == 3)
	{
		USES_CONVERSION;
		strcpy_s(m_vDataInfo[nNo].chRecordTime,
			sizeof(m_vDataInfo[nNo].chRecordTime), W2A(strTime));
	}
}

//删除值
BOOL CMGData::ModifyYsData(int nNo, BOOL bDelOrInsert)
{
	if (nNo < 0 || nNo >= (int)m_vDataInfo.size() || m_vDataInfo.empty())
	{
		return FALSE;
	}
	if (bDelOrInsert)
	{
		m_vDataInfo.erase(m_vDataInfo.begin() + nNo);
	}
	else
	{
		m_vDataInfo.insert(m_vDataInfo.begin() + nNo, m_vDataInfo[nNo]);
	}
	
	m_MGProInfo.nDataCnt = (int)m_vDataInfo.size();
	return TRUE;
}

//重新赋值记录时间
void CMGData::SetYSTime(COleDateTime stTime, int nNo, int nGap, int nCount)
{
	if (nNo < 0 || nNo >(int)m_vDataInfo.size() || m_vDataInfo.empty())
	{
		return;
	}
	USES_CONVERSION;
	SYSTEMTIME sys_time;
	stTime.GetAsSystemTime(sys_time);
	CTime c_time;
	c_time = CTime(sys_time);
	CString strTime(L"");
	for (int i = nNo; i < (int)m_vDataInfo.size() && i < nCount + nNo; ++i)
	{
		strTime = c_time.Format(L"%Y-%m-%d %H:%M:%S");
		strcpy_s(m_vDataInfo[i].chRecordTime, sizeof(m_vDataInfo[i].chRecordTime), W2A(strTime));
		c_time += nGap;
	}
}

void CMGData::GetMgDataNo(vector<DATA_INFO> vDataInfo, int nNo, int &nBeginNo, int &nEndNo)
{
	if (vDataInfo.empty() || nNo < 0 || nNo >= (int)vDataInfo.size())
	{
		return;
	}
	nBeginNo = nNo;
	nEndNo = nNo;
	int nBenji = vDataInfo[nNo].nIdx;
	int nJiaZai = vDataInfo[nNo].nJiaZaiOrXieZai;

	BOOL bFind = FALSE;
	for (int i = nNo + 1; i < (int)vDataInfo.size(); ++i)
	{
		if (nBenji != vDataInfo[i].nIdx || nJiaZai != vDataInfo[i].nJiaZaiOrXieZai || i == (int)vDataInfo.size() - 1)
		{
			nEndNo = i - 1;
			break;
		}
	}
	for (int i = nNo - 1; i >= 0; i--)
	{
		if (nBenji != vDataInfo[i].nIdx || nJiaZai != vDataInfo[i].nJiaZaiOrXieZai || i == 0)
		{
			nBeginNo = i + 1;
			break;
		}
	}
}


void CMGData::ModifyOriginalVal(int nNo, int nCol, float fVal, CString strBeiZhu)
{
	if (nNo >= (int)m_vDataInfo.size())
	{
		return;
	}

	if (0 == nCol)	//修改本级
	{
		//先根据当前序号，计算出开始序号和结束序号
		int nBeginNo = 0, nEndNo = 0;
		GetMgDataNo(m_vDataInfo, nNo, nBeginNo, nEndNo);
		for (int i = nBeginNo; i <= nEndNo; ++i)
		{
			m_vDataInfo[i].fLoadValue = fVal;
		}
	}
	else if (1 == nCol) //修改实测荷载
	{
		m_vDataInfo[nNo].fCurLoad = fVal;
	}
	else if (4 == nCol) //平均位移
	{
		m_vDataInfo[nNo].fWeiyiAvg += fVal;
		CheckValue(m_vDataInfo[nNo].fWeiyiAvg);
		for (int i = 0; i < nWeiYiCnt; ++i)
		{
			if (m_MGProInfo.chChanelUsed[i] > 0)
			{
				m_vDataInfo[nNo].fWeiyi[i] += fVal;
				CheckValue(m_vDataInfo[nNo].fWeiyi[i]);
			}
		}
	}
	else if (nCol >= 5 && nCol <= 6) //其他位移
	{
		m_vDataInfo[nNo].fWeiyi[nCol - 5] = fVal;
		int nCnt = 0;
		float fAvg = 0;
		for (int i = 0; i < nWeiYiCnt; ++i)
		{
			if (m_MGProInfo.chChanelUsed[i] > 0 && m_MGProInfo.chChannelSel[i])
			{
				fAvg += m_vDataInfo[nNo].fWeiyi[i];
				nCnt++;
			}
		}
		if (nCnt < 1)
		{
			m_vDataInfo[nNo].fWeiyiAvg = 0;
		}
		else
		{
			m_vDataInfo[nNo].fWeiyiAvg = (float)(fAvg / (nCnt * 1.0));
		}
		
		CheckValue(m_vDataInfo[nNo].fWeiyiAvg);
	}
	else if (7 == nCol) //修改备注
	{
		USES_CONVERSION;
		int nLen = strlen(W2A(strBeiZhu));
		if (nLen >= 120)
		{
			strBeiZhu = strBeiZhu.Left(55);
		}
		strcpy_s(m_vDataInfo[nNo].chBeiZhu,
			sizeof(m_vDataInfo[nNo].chBeiZhu), W2A(strBeiZhu));
	}
	InitCalcData();
}

//重新计算平均值
void CMGData::ReCalcAvgData()
{
	if (!g_bInitData)
	{
		return;
	}
	float fAvg = 0;
	int nCnt = 0;
	for (int i = 0; i < (int)m_vDataInfo.size(); ++i)
	{
		nCnt = 0;
		fAvg = 0;
		for (int n = 0; n < nWeiYiCnt; ++n)
		{
			if (m_MGProInfo.chChanelUsed[n] != 0 && m_MGProInfo.chChannelSel[n])
			{
				fAvg += m_vDataInfo[i].fWeiyi[n];
				nCnt++;
			}
		}
		if (nCnt < 1)
		{
			m_vDataInfo[i].fWeiyiAvg = 0;
		}
		else
		{
			m_vDataInfo[i].fWeiyiAvg = (float)(fAvg / (nCnt * 1.0));
			CheckValue(m_vDataInfo[i].fWeiyiAvg);
		}			
	}
	//重新计算所有值
	InitCalcData();
}

void CMGData::ModifyTiemGap()
{
	for (int i = 0; i < (int)m_vDataInfo.size(); ++i)
	{
		if (m_vDataInfo[i].nJiaZaiOrXieZai == LOAD_VALUE)
		{
			if (m_vDataInfo[i].nRecordId < 12)
			{
				m_vDataInfo[i].nTimeGap = m_MGProInfo.nLoadTimeList[m_vDataInfo[i].nRecordId];
			}
			else
			{
				m_vDataInfo[i].nTimeGap = m_MGProInfo.nLoadTimeList[m_vDataInfo[i].nRecordId];
			}
		}
		else
		{
			if (m_vDataInfo[i].nRecordId < 12)
			{
				m_vDataInfo[i].nTimeGap = m_MGProInfo.nLoadOffTimeList[m_vDataInfo[i].nRecordId];
			}
			else
			{
				m_vDataInfo[i].nTimeGap = m_MGProInfo.nLoadOffTimeList[m_vDataInfo[i].nRecordId];
			}
		}
	}
	InitCalcData();
}

//插入一行数据 
void CMGData::InsertTimeData(int nNo, int nBenjiId, int nDataType, BOOL bAdd)
{
	//插入数据
	InsertMgData(m_vDataInfo, nNo, bAdd);
	//反赋值
	m_MGProInfo.nDataCnt = (int)m_vDataInfo.size();
	//重新计算
	InitCalcData();
}

//插入一行数据 
void CMGData::InsertMgData(vector<DATA_INFO> &vData, int nNo, BOOL bAdd)
{
	int nBeginNo = 0, nEndNo = 0;
	GetMgDataNo(vData, nNo, nBeginNo, nEndNo);
	if (bAdd)
	{
		vData.insert(vData.begin() + nNo, vData[nNo]);
		for (int i = nNo + 1; i <= nEndNo + 1; ++i)
		{
			vData[i].nRecordId++;
		}
	}
	else
	{
		vData.erase(vData.begin() + nNo);
		if (nNo < (int)vData.size() - 1)
		{
			for (int i = nNo; i <= nEndNo - 1; ++i)
			{
				vData[i].nRecordId--;
			}
		}
	}
}

//插入一级
void CMGData::InsertGrade(int nNo, int nDataType, BOOL bAdd)
{
	//插入一级
	InsertMgGrade(m_vDataInfo, nNo, bAdd);
	//反赋值
	m_MGProInfo.nDataCnt = (int)m_vDataInfo.size();
	//重新计算数据
	InitCalcData();
}

//插入一级
void CMGData::InsertMgGrade(vector<DATA_INFO> &vData, int nNo, BOOL bAdd)
{
	int nBeginNo = 0, nEndNo = 0;
	GetMgDataNo(vData, nNo, nBeginNo, nEndNo);
	int nJiaZai = vData[nNo].nJiaZaiOrXieZai;
	if (bAdd)
	{
		vData.insert(vData.begin() + nEndNo + 1, vData[nNo]);
		vData[nEndNo + 1].nIdx++;
		for (int i = nEndNo + 2; i < (int)vData.size(); ++i)
		{
			if (nJiaZai != vData[i].nJiaZaiOrXieZai)
			{
				break;
			}
			vData[i].nIdx++;
		}
	}
	else
	{
		for (int i = nBeginNo; i <= nEndNo; ++i)
		{
			vData.erase(vData.begin() + nBeginNo);
		}
		for (int i = nBeginNo; i < (int)vData.size(); ++i)
		{
			if (nJiaZai != vData[i].nJiaZaiOrXieZai)
			{
				break;
			}
			vData[i].nIdx--;
		}
	}
}

//设置拉脱点
void CMGData::SetLatuoDian(int nNo)
{
	CancelLatuoDian();

	int nBeginNo = 0, nEndNo = 0;
	GetMgDataNo(m_vDataInfo, nNo, nBeginNo, nEndNo);
	for (int i = 0; i < (int)m_vDataInfo.size(); ++i)
	{
		if (i < nBeginNo)
		{
			m_vDataInfo[i].chLatuodian = 0;
		}
		else
		{
			m_vDataInfo[i].chLatuodian = 1;
		}		
	}
	//重新计算数据
	InitCalcData();
}

//取消拉脱点
void CMGData::CancelLatuoDian()
{
	for (int i = 0; i < (int)m_vDataInfo.size(); ++i)
	{
		m_vDataInfo[i].chLatuodian = 0;
	}
	//重新计算数据
	InitCalcData();
}

//已经全加/乘一固定值 bAdd :true +   False *
void CMGData::AddOneValue(int nRow, int Col, float fVal, int nDataType, BOOL bAdd)
{
	AddMgOneValue(m_vDataInfo, m_MGProInfo, nRow, Col, fVal, bAdd);
	InitCalcData();
}

//锚杆已经全加/乘一固定值 bAdd :true +   False *
void CMGData::AddMgOneValue(vector<DATA_INFO> &vData, MG_PROJECT_INFO HZProInfo, int nRow, int Col, float fVal, BOOL bAdd)
{
	if (fVal > -EPSINON && fVal < EPSINON)
	{
		return;
	}
	for (int i = 1; i < (int)vData.size(); ++i)
	{
		if (i < nRow)
		{
			continue;
		}
		if (bAdd)
		{
			vData[i].fWeiyiAvg += fVal;
			CheckValue(vData[i].fWeiyiAvg);
			for (int n = 0; n < nWeiYiCnt; ++n)
			{
				if (HZProInfo.chChanelUsed[n] > 0)
				{
					vData[i].fWeiyi[n] += fVal;
					CheckValue(vData[i].fWeiyi[n]);
				}
			}
		}
		else
		{
			vData[i].fWeiyiAvg *= fVal;
			CheckValue(vData[i].fWeiyiAvg);
			for (int n = 0; n < nWeiYiCnt; ++n)
			{
				if (HZProInfo.chChanelUsed[n] > 0)
				{
					vData[i].fWeiyi[n] *= fVal;
					CheckValue(vData[i].fWeiyi[n]);
				}
			}
		}
	}
}

//已经全加/乘一固定值 bAdd :true +   False *   nType 1：加载级 2：实测荷载 3：时间
void CMGData::AddOneValueOther(int nRow, int Col, int nType, float fVal, int nDataType, BOOL bAdd)
{
	AddMgOneValueOther(m_vDataInfo, nRow, Col, nType, fVal, bAdd);
	InitCalcData();
}

void CMGData::AddMgOneValueOther(vector<DATA_INFO> &vData, int nRow, int Col, int nType, float fVal, BOOL bAdd)
{
	BOOL bExist = FALSE;
	USES_CONVERSION;
	CString strTime(L"");
	COleDateTime   tm;
	for (int i = 1; i < (int)vData.size(); ++i)
	{
		if (i < nRow)
		{
			continue;
		}
		if (bAdd)
		{
			if (nType == 1)
			{
				vData[i].fLoadValue += fVal;
			}
			else if (nType == 2)
			{
				vData[i].fCurLoad += fVal;
			}
			else if (nType == 3)
			{
				strTime = vData[i].chRecordTime;
				tm.ParseDateTime(strTime);
				CTime ct(tm.GetYear(), tm.GetMonth(), tm.GetDay(), tm.GetHour(), tm.GetMinute(), tm.GetSecond());
				ct += (int(fVal));
				strTime = ct.Format(L"%Y-%m-%d %H:%M:%S");
				strcpy_s(vData[i].chRecordTime, sizeof(vData[i].chRecordTime), W2A(strTime));
			}
		}
		else
		{
			if (nType == 1)
			{
				vData[i].fLoadValue *= fVal;
			}
			else if (nType == 2)
			{
				vData[i].fCurLoad *= fVal;
			}
		}
	}
}

//原始记录表时间
void CMGData::ModifyOriginalTimeGap()
{
	for (int i = 0; i < (int)m_vDataInfo_Old.size(); ++i)
	{
		if (m_vDataInfo_Old[i].nJiaZaiOrXieZai == LOAD_VALUE)
		{
			if (m_vDataInfo_Old[i].nRecordId < 12)
			{
				m_vDataInfo_Old[i].nTimeGap = m_MGProInfo.nLoadTimeList[m_vDataInfo[i].nRecordId];
			}
			else
			{
				m_vDataInfo_Old[i].nTimeGap = m_MGProInfo.nLoadTimeList[m_vDataInfo[i].nRecordId];
			}
		}
		else
		{
			if (m_vDataInfo_Old[i].nRecordId < 12)
			{
				m_vDataInfo_Old[i].nTimeGap = m_MGProInfo.nLoadOffTimeList[m_vDataInfo[i].nRecordId];
			}
			else
			{
				m_vDataInfo_Old[i].nTimeGap = m_MGProInfo.nLoadOffTimeList[m_vDataInfo[i].nRecordId];
			}
		}
	}
}

//移动曲线改变值
int CMGData::MoveCurve(int &nNo, float fVal, DATA_TYPE DataType, CURVE_TYPE CurveType)
{
	if (!g_bInitData)
	{
		return -1;
	}
	if (DataType == DATA_0 )
	{
		if (nNo >= 0 && nNo < (int)m_vDataInfo.size())
		{
			m_vDataInfo[nNo].fWeiyiAvg += fVal;
		}
	}
	else if (DataType == DATA_1 || DataType == DATA_2)
	{
		MoveMgModifyVal(nNo, fVal);
	}
	return nNo;
}

//移动曲线改变统计值
void CMGData::MoveMgModifyVal(int nNo, float fVal)
{
	int nId = m_vDataInfo[0].nIdx;
	int nJaiZai = m_vDataInfo[0].nJiaZaiOrXieZai;
	int nCnt = 0;
	for (int i = 1; i < (int)m_vDataInfo.size(); ++i)
	{
		if (nId != m_vDataInfo[i].nIdx || nJaiZai != m_vDataInfo[i].nJiaZaiOrXieZai)
		{
			nCnt++;
			nId = m_vDataInfo[i].nIdx;
			nJaiZai = m_vDataInfo[i].nJiaZaiOrXieZai;
		}
		if (nCnt == nNo)
		{
			m_vDataInfo[i].fWeiyiAvg += fVal;
			CheckValue(m_vDataInfo[i].fWeiyiAvg);
			for (int n = 0; n < 8; ++n)
			{
				if (m_MGProInfo.chChanelUsed[n] > 0)
				{
					m_vDataInfo[i].fWeiyi[n] += fVal;
					CheckValue(m_vDataInfo[i].fWeiyi[n]);
				}
			}
		}
	}
	InitCalcData();
}

//根据Id 序号 获取vector 序号
int CMGData::GetMgVectorNo(int nIdNo)
{
	int nId = m_vDataInfo[0].nIdx;
	int nJaiZai = m_vDataInfo[0].nJiaZaiOrXieZai;
	int nCnt = 0;
	int i = 0;
	for (i = 1; i < (int)m_vDataInfo.size(); ++i)
	{
		if (nId != m_vDataInfo[i].nIdx || nJaiZai != m_vDataInfo[i].nJiaZaiOrXieZai)
		{
			nCnt++;
			nId = m_vDataInfo[i].nIdx;
			nJaiZai = m_vDataInfo[i].nJiaZaiOrXieZai;

			if (nCnt == nIdNo)
			{
				break;
			}
		}
	}
	return i;
}